home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Risc World 3
/
Risc World 3.iso
/
SOFTWARE
/
ISSUE4
/
POWERBASE
/
PB384
/
!Powerbase
/
!RunImage
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
2002-11-09
|
481KB
|
22,092 lines
><PBase$Dir>.!RunImage
!RunImage for !Powerbase database
D.L. Haslam & S.R. Haslam
Heap Manager (module + BASIC)
S.R. Haslam
Rendered 32-bit compatible by Christopher Bazley (03-11-2002)
Documentation and source code by Harriet Bazley available on website
Dial utility
Justin Fletcher
Helpreader (system for on-line help text)
Ben Summers
New high-res icons for files
Lenny <lenny@argonet.co.uk>
http://www.argonet.co.uk/users/lenny/index.html
,:
version$="8.34 (06-10-2002)"
Adapted to comply with anti-aliased desktop font in RISC OS 3.5 & later
Can use scrollable lists.
Printing uses RISC OS drivers.
Direct mail-merging with OvationPro requires v.1.3 of !Impulse applet
,"Error: "+
$+" during initialisation at line "+
"Hourglass_On"
"OS_Byte",228,1
"OS_Byte",202,0,255
,kbdstatus%
block% &1C00,msgnum% 4
"OS_ReadVarVal","Pbase$Dir",block%,255
#?block%?L%=13:program$=
leaf($block%):progname$=
program$,2)
PbaseDir$=leafnamepath$
program$ automatically reflects whatever name application is called
It is used in Wimp_Initialise so this name appears on task list
Also inserted into Info box.
check_resources:
### Check for missing files ###
### All present & correct. Initialise Wimp & Impulse module ###
$block%="TASK":!msgnum%=0
mask%=(1<<4)+(1<<5)
"Wimp_Initialise",300,!block%,progname$,msgnum%
version%,mytask%
version%<310
0,"This version of Powerbase is only suitable for RISC OS 3.10 or greater. Contact Powerbase Support for a suitable version."
"Impulse_Initialise",003,mytask%,"Powerbase",-1
Do NOT use progname$ here or client tasks trying to interrogate
"Powerbase" will not have their Impulse commands recognized!
initheaps(128,128)
### Load message file so that 'proper' error-handler can be used ###
msgbuff% &100,param$(3),att$(3)
4'f$="<PBase$Dir>.Resources.Messages"
"MessageTrans_FileInfo",,f$
flags%,,len%
errormsg% len%
"OS_Module",6,,,17+
(f$)
,,filedesc%
$(filedesc%+16)=f$
"MessageTrans_OpenFile",filedesc%,filedesc%+16,errormsg%
: fatal_err%=255:moan_err%=254
wimp_error(
Mi% 20,Mo% 20
getscreensize(ScreenWidth%,ScreenHeight%,Vpix%)
"XWimp_ReadSysInfo",8
Desktopfont%;flags%
(flags%
Desktopfont%=0
### Load private sprites ###
"OS_File",5,"<PBase$Dir>.Resources.Sprites22"
d%,,,,len%
sprites% len%+4
!sprites%=len%+4
load_sprites
### Get Internet addresses ###
("<Pbase$Dir>.Resources.Internet")
Web$=
#F:Email$=
close_file(F)
get_configuration("<Pbase$Dir>.Resources.Config","main")
dim_arrays(MaxFields%+12,MaxKeys%,MaxTabs%,MaxCols%,MaxLists%,MaxLibs%)
printer_palette
allocate_buffers
load_functionkeys
init_vars
create_anchors
impulse_methods
create_windows
make_menus
get_defaults
select(prefsW%,36):
deselect(prefsW%,35):
shade(prefsW%,35,
select(csvW%,19):
deselect(csvW%,18)
scroll_icons(MaxCols%)
"OS_ReadMonotonicTime"
ReturnAfter%
ReturnEvery%=100
ReturnAfter%+=ReturnEvery%
banner
iconbar_icon("")
`9present%=
:library$="":toolheight%=770:padheight%=316
find_libraries(CustDir$,MaxSize%,NextLib%,MaxLibs%)
### Respond to double-click on database when Powerbase not yet running ###
"OS_GetEnv"
ComString$
ComString$,"-database")
f4 File$=
ComString$,
ComString$,"-database")+10)
"OS_GSTrans",File$,
13),255
,File$,L%
File$=
File$,L%)
get_it_in(File$)
shade(passW%,17,
Allows use of Access Control List. Change to FALSE if not wanted
set_return
wimp_error(
### Establish place to jump back to once we start polling ###
### Now ready to roll! ###
"Hourglass_Off"
poll(
quit%
close_down
poll(idle%)
"OS_Byte",229,1:
"OS_Byte",124
idle%
"Wimp_PollIdle",mask%,block%,ReturnAfter%
reason%
"Wimp_Poll",mask%,block%
reason%
reason%
autosave%>0
Access%=
check_save(
($Interval%))
Impulse_wait%
merging%
start_merge(mergeW%)
flash%>0
&
invert(mainW%,field%(flash%))
OLE%>0
check_date_stamp
set_return
redraw(!block%)
open_it(!block%)
close_it(!block%)
mouse(block%!0,block%!4,block%!8,block%!12,block%!16)
end_drag
process_key
menu_select
!block%=mainW%
returnto%=block%!4:
"OS_Byte",202,caps%,111
set_keyboard(!block%,block%!4)
17,18:
"Impulse_Decode",reason%,block%,,,,methodtable%,mytask%
reason%,,,,,token%,params%,object%
reason%>=&200
reason%
V
&200,&201:
token%<>-1
Impulse_command_received(token%,params%,object%)
/
&202:
Impulse_reply(token%,params%)
.
&203:
Impulse_send(token%,object%)
9
&204:
Impulse_receive(token%,params%,object%)
message
not_acknowledged
complete(N%)
Allows windows to redraw inside long procedures
I%=1
poll(
check_date_stamp
"OS_File",5,OLE$
,,,r3%
r3%<>OLEDS%
update_external(REC%):OLEDS%=r3%
set_return
time%
"OS_ReadMonotonicTime"
time%
time%-ReturnAfter%>0
ReturnAfter%+=ReturnEvery%
Shutdown routines ---------------------------------------------------
close_down
#0:$block%="TASK":
"Wimp_CloseDown",mytask%,!block%:
,"Error: "+
$+" during closedown at line "+
"Hourglass_Smash"
"Impulse_CloseDown",mytask%
$block%="TASK"
"Wimp_CloseDown",mytask%,!block%
flags%,F,Postpone%
special%(10)
(libfunc$+"_function(10)")
Postpone%
"Hourglass_Smash"
"OS_File",5,$database%
d%=2
"XOS_Find",128,$database%+".Junk"
F;flags%
(flags%
1)=0
@
close_file(F):
"OS_CLI","Remove "+$database%+".Junk"
present%=7
6
save_marks:
clear_marks(RA%):
warn_of_marks
save_winpos
/
ramwarn%
ram%
softerror("",63)
F
design%
protect%
force%
save_form($database%+".Form")
%
altered%
save_everything
memory_usage
auto_csv(
blob_deleterestore("D")
close_files
link$()="":calc$()=""
#
close_log("<Log$Dir>.Log")
softerror("",218)
$database%<>"No data"
softerror("",145)
kill_scrollers(
hide_windows
delete_icons(mainW%,0)
delete_icons(numscrollW%,0)
ic%=24
text(keypadW%,ic%)=""
deselect(matchW%,4):
deselect(matchW%,6):
deselect(matchW%,12)
recover_memory
init_vars
get_defaults
read_colours("<Pbase$Dir>.Resources.FieldCols")
CSHkeyptr%()=-1:SHtabptr%()=-1:SHundoptr%()=-1:SHscrollptr%()=-1
$Subfilename%="Subfile 0"
$NewName%="!NewName"
select(prefsW%,36):
deselect(prefsW%,35):
shade(prefsW%,35,
I%=0
LastTable%
printrel$(I%)=""
tableW%(I%)>0
!block%=tableW%(I%):
"Wimp_DeleteWindow",,block%
tableW%()=0:TabTitle%()=0
tableW%()=0:TabTitle%()=0
field$()="":ephemera$()=""
$Password%=""
$$Records%="100":$Increment%="25"
present%=
exit%=
I%=0
lit(utilityM%,I%,
lit(iconbarM%,1,
lit(iconbarM%,2,
lit(iconbarM%,3,
lit(iconbarM%,4,
lit(validateM%,1,
):ptr%=validateM%+52:ptr%!4=-1
lit(indexM%,1,
):ptr%=indexM%+52:ptr%!4=-1
lit(printM%,5,
lit(printM%,7,
lit(printM%,8,
lit(printM%,9,
lit(mainM%,7,
text(prefsW%,45)="":
shade(prefsW%,45,
"OS_CLI","Unset Acl$Dir"
"OS_CLI","Unset Log$Dir"
"OS_CLI","Unset Dbase$Dir"
$database%="No data"
iconbar_icon("No data")
special%()=
"OS_Byte",202,kbdstatus%
save_everything
Access%
save_links
save_calcs
save_subfilenames
save_keys
save_all_tables
changed%=
update_calcs(0)
asterisk(
delete_icons(wi%,ic%)
!block%=wi%:block%!4=ic%
"Wimp_DeleteIcon",,block%
ic%+=1:block%!4=ic%
"Wimp_GetIconState",,block%
((block%!24)
(1<<23))>0
close_files
Check all file-handles from 1-255 for open files
Check if open files belong to Powerbase or the database
If so, close them and report
F%,V%,P%,F$
F%=1
"XOS_Args",7,F%,block%,,,256
(V%
1)=0
P%=0
P%+=1
block%?P%=0
block%?P%=13
59
$block%,program$)>0
$block%,$database%)>0
6( F$=
" "+
(F%),3)+" "+$block%
8S
wimp_error(
,254,0,"File "+F$+" was left open. It has now been closed.")
9
close_file(printhandle%)
close_file(csvhandle%)
Need to close printer file explicitly since pathname doesn't show
any connection with Powerbase or database
close_file(
filehandle%)
filehandle%>0
#filehandle%
filehandle%=0
recover_memory
scrap_block(headanchor%)
scrap_block(lineanchor%)
scrap_block(textanchor%)
scrap_block(formanchor%)
scrap_block(selanchor%)
scrap_block(tempanchor%)
scrap_block(balanchor%)
scrap_block(flaganchor%)
scrap_block(transanchor%)
scrap_block(sprsanchor%)
scrap_block(titleanchor%)
scrap_block(recanchor%)
scrap_block(saveanchor%)
scrap_block(logoanchor%)
scrap_block(fieldmenuanchor%)
scrap_block(usermenuanchor%)
scrap_block(tablemenuanchor%)
scrap_block(indexmenuanchor%)
scrap_block(markanchor%)
scrap_block(blankanchor%)
scrap_block(fontanchor%)
scrap_block(urlanchor%)
scrap_block(sortanchor%)
I%=0
MaxTabs%
scrap_block(tabanchor%(I%))
scrap_block(undoanchor%(I%))
I%=0
MaxKeys%+1
scrap_block(keyanchor%(I%))
I%=0
MaxLists%-1
scrap_block(scrollanchor%(I%))
I%=1
fields%
present%=7
chartype%(I%)=40
scrap_block(Rf%(I%))
Error handling ------------------------------------------------------
wimp_error(return%,err%,erl%,err$)
type%,result%
close_down:
,"Error: "+
$+" during error handler at line "+
"Wimp_CommandWindow",-1
block%!0=err%
return%
err%<>fatal_err%
err%=moan_err%
{9 type%=17:
OK button and no "Error from" in title
|
}' type%=3:
OK and Cancel buttons
~@ err$+=" at "+
(erl%)+" (OK to continue, Cancel to quit)"
type%=2:
Cancel buttom
, err$+=" (Powerbase must quit at once)"
close_files
recover_memory
$(block%+4)=err$+
"Wimp_ReportError",block%,type%,"Powerbase"+
,result%
result=1 means OK selected, 2 means Cancel selected
result%=2
close_down
softerror(E$,E%)
E%>0
M$="Err"+
E$<>""
M$+=","+E$
$(block%+4)=
msg(M$)
$(block%+4)=E$
!block%=255
"Wimp_ReportError",block%,1+(1<<8)+(1<<9),"Powerbase","!powerbase"
confirm(string$)
!block%=255
$(block%+4)=string$+
"Wimp_ReportError",block%,19,"Powerbase: please confirm"+
,result%
=result%=1
inform(M$,M%,T%)
M$=""
text(informW%,0)=
msg("Err"+
(M%))
text(informW%,0)=M$
position_window(informW%,0,0,0,0,0,0)
complete(4)
T%>0
(T%*100):
close_window(informW%)
### Use MessageTrans to display a message from the Messages file ###
msg(token$)
result$,msgparams$,S$,P%,Q%,p%
param$()=""
token$,",")
P%>0
" msgparams$=
token$,P%+1)+","
token$=
token$,P%-1)
P%=0
Q%=P%+1
P%=
msgparams$,",",Q%)
P%>0
" S$=
msgparams$,Q%,P%-Q%)
! S$=
replace(S$,"\",",")
param$(p%)=S$
p%+=1
P%=0
"MessageTrans_Lookup",filedesc%,token$,msgbuff%,&100,param$(0),param$(1),param$(2),param$(3)
,,result$
=result$
replace(S$,found$,with$)
P%=
S$,found$)
P%>0
S$,P%,1)=with$
P%=0
asterisk(on%)
on%
$RecInfo%)<>"*"
$RecInfo%+=" *":ramwarn%=
$RecInfo%)="*"
$RecInfo%=
$RecInfo%))
altered%=on%
E!block%=mainW%:
"Wimp_GetWindowOutline",,block%:ymax%=block%!16
"Wimp_GetWindowState",,block%
"Wimp_ForceRedraw",-1,block%!4,block%!16,block%!12,ymax%
create_anchors
)headanchor%=
create_anchor("Heading")
*lineanchor%=
create_anchor("TextLine")
&textanchor%=
create_anchor("Text")
&formanchor%=
create_anchor("Form")
.sprsanchor%=
create_anchor("DbaseSprites")
-titleanchor%=
create_anchor("DbaseTitle")
&tempanchor%=
create_anchor("Temp")
(balanchor%=
create_anchor("Balance")
'flaganchor%=
create_anchor("Flags")
/transanchor%=
create_anchor("DataTransfer")
)selanchor%=
create_anchor("PrintSel")
*recanchor%=
create_anchor("RecordNum")
,saveanchor%=
create_anchor("SaveBuffer")
&logoanchor%=
create_anchor("Logo")
0fieldmenuanchor%=
create_anchor("FieldMenu")
.usermenuanchor%=
create_anchor("UserMenu")
0tablemenuanchor%=
create_anchor("TableMenu")
0indexmenuanchor%=
create_anchor("IndexMenu")
&markanchor%=
create_anchor("Mark")
(blankanchor%=
create_anchor("Blank")
'fontanchor%=
create_anchor("Fonts")
$urlanchor%=
create_anchor("URL")
&sortanchor%=
create_anchor("Sort")
I%=0
MaxKeys%+1
2 keyanchor%(I%)=
create_anchor("Key #"+
(I%))
I%=0
MaxTabs%
5 tabanchor%(I%)=
create_anchor("VTable #"+
(I%))
: undoanchor%(I%)=
create_anchor("UndoVTable #"+
(I%))
I%=0
MaxLists%-1
: scrollanchor%(I%)=
create_anchor("Scroller #"+
(I%))
impulse_methods
PASS=0
P%=methodtable%
[OPT PASS
equd 0
)
method(0,1,"GetPathname","")
'
method(0,2,"Selection","")
(
method(0,3,"ParseQuery","")
'
method(0,4,"GetRecord","")
'
method(0,5,"PutRecord","")
(
method(0,6,"ExpandCode","")
&
method(0,7,"GetField","")
)
method(0,8,"GetExpanded","")
'
method(0,9,"NextMatch","")
method(-1,-1,"","")
PASS
method(Flags,Token,Method$,Syntax$)
[OPT PASS
equd Flags
equd Token
equs Method$+
equs Syntax$+
align
=PASS
iconbar_icon(name$)
len%,old%
name$
3 $dbase%="No data":len%=
string_width($dbase%)
\ pbaseicon%=
create_icon(0,-1,0,-16,len%,110,&1700312B,"",dbase%,psprite%,
($dbase%)+1)
/ $dbase%=name$:len%=
string_width($dbase%)
old%=pbaseicon%
_ pbaseicon%=
create_icon(old%,-3,0,-16,len%,110,&1700312B,"",dbase%,psprite%,
($dbase%)+1)
!block%=-1:block%!4=old%
"Wimp_DeleteIcon",,block%
load_sprites
Loads private sprites during program initialisation
Also called if screen resolution changes
x%,y%,f$,f1$
"OS_ReadModeVariable",-1,4
,,x%
"OS_ReadModeVariable",-1,5
,,y%
x%=1
y%=1
f$="!Sprites22":f1$="Sprites22"
(x%=2
y%=2)
(y%<>x%)
f$="!Sprites":f1$="Sprites"
"OS_CLI","IconSprites <Pbase$Dir>."+f$
"OS_File",255,"<PBase$Dir>.Resources."+f1$,sprites%+4
banner
d%,F,S$,f$
text(bannerW%,6)="v. "+version$
4'f$="<Pbase$Dir>.Resources.Temp.pbr"
"OS_File",5,f$
d%=1
register
"OS_File",5,"<Pbase$Dir>.reg"
d%=1
("<Pbase$Dir>.reg")
#F,S$:S$=
encrypt(S$,
close_file(F)
</ $
text(infoW%,9)=S$:$
text(bannerW%,5)=S$
=1 $
text(bannerW%,2)="":$
text(bannerW%,3)=""
>+ $
text(bannerW%,4)="Registered user:"
set_icon_cols(infoW%,9,23)
d%=0
Bannertime%>0
position_window(bannerW%,0,0,0,0,0,0)
complete(10)
>500
(d%=1
>Bannertime%)
Display 5 sec for unregistered copy, otherwise for configured time
Skip banner altogether if registered & configured time=0
close_window(bannerW%)
title(area%,x%,y%,ww%,wh%)
sw%,sh%,mult%,div%,factor,ex%,ey%
"OS_SpriteOp",512+40,area%,area%+area%!8
,,,sw%,sh%
sw%=sw%*2:sh%=sh%*2
r1%=ww%/sw%:r2%=wh%/sh%
r1%<=r2%
mult%=ww%:div%=sw%
mult%=wh%:div%=sh%
mult%=mult%*0.9
W x%+=(ww%-sw%*mult%/div%)
X y%+=(wh%-sh%*mult%/div%)
Y=!scale%=mult%:scale%!4=mult%:scale%!8=div%:scale%!12=div%
"ColourTrans_SelectTable",area%,area%+area%!8,-1,-1,wdtrans%,3
"OS_SpriteOp",512+52,area%,area%+area%!8,x%,y%,0,scale%,wdtrans%
get_defaults
path$
`"path$="<Pbase$Dir>.Resources."
get_configuration(path$+"Config","main")
get_preferences(prefsW%,path$+"Preference")
get_csv_options(path$+"CSVoptions")
get_options(printW%,printerW%,path$+"!PrintOpts")
allocate_buffers
h(indirectionmem%=&6000:menumem%=&3000
buffbase% indirectionmem%:endbuff%=buffbase%+indirectionmem%:buff%=buffbase%
menuindir% &100:menubuff%=menuindir%
iconblock% &100,paneblock% &600,savebuff% &400,choices% &100,remember% &1000
menblk% menumem%:men_end%=menblk%+menumem%:menu_ptr%=menblk%
methodtable% 256:
For Impulse module
utctime% 5,datebuffer% 16,dateformat% 16,ordinals% 36:
For date & time
date% 6:$date%=
(0)):
For subfile updates
key 256,calcrow% 128,hide% 128,mandatory% 128,zerolen% 128,displayit% 128
fontbuff% &100
menhelpblock% &100
paint% 8:$paint%="file_ff9"
winsp% 20:$winsp%="R5;Swindow,pwindow"
hand% 16:$hand%="Pptr_hand,4,0"
writep% 16:$writep%="Pptr_write,4,4"
writenum% 20:$writenum%="Pptr_write,4,4;A0-9"
tick% 12:$tick%="Snull,yes"
dbase% 20:$dbase%="No data"
psprite% 15:$psprite%="S!"+progname$
menspr% 30,mentxt% 1:$menspr%="Sgright,pgright;Pptr_menu;R5":$mentxt%=""
winspr% 20,wintxt% 1:$winspr%="R5;Swindow":$wintxt%=""
transform% 16,rectangle% 16,rectangle2% 16:
For printer
origin%(4):
For printer
I%=1
P% 8:origin%(I%)=P%
scale% 16,wdtrans% 256
Pcol% 4
dim_arrays(F%,K%,T%,C%,L%,LB%)
desc%(F%),Tag$(F%),field%(F%+1),F$(F%),Rf%(F%)
len%(F%),maxlen%(F%),truelen%(F%),diff%(F%),maxlenP%(F%),Tab%(F%),Tab2%(F%)
numeric%(F%),chartype%(F%),fix%(F%)
link$(F%),calc$(F%),field$(F%),cfield$(F%),update$(F%)
ephemera$(9,4)
Date%(5)
Index$(K%+1),KL%(K%+1),KW%(K%+1,3),KF%(K%+1,3)
3Index$(0)="PrimaryKey":Index$(K%+1)="Temporary"
key$(K%+1),case%(K%+1),incspace%(K%+1),null%(K%+1)
keyfield%(3),WD%(3),Ext%(10)
Label$(48,20)
ftypeM%(7),fmenu$(7),flist%(7),choice$(4)
table$(T%+1),tableW%(T%),TabTitle%(T%),printrel$(T%)
tabfieldlen%(C%),rel%(C%),tabhead$(C%,1)
fcol%(10),wimpcol%(15)
Subfile%(5),filemem%(5,K%)
buttonfield%(1,28),winbuff%(4,1)
live%(20)
MC%=30:
L%(MC%)
menfield%(30,1)
SHkeyptr%(K%+1),keyanchor%(K%+1)
SHtabptr%(T%),SHundoptr%(T%),tabanchor%(T%),undoanchor%(T%)
scrollerW%(L%-1),scrolldata%(L%-1,9),sclen%(L%-1,3)
SHscrollptr%(L%-1),scrollanchor%(L%-1)
lib$(LB%),lib%(LB%),special%(10):special%()=
scroller_ptr%(L%-1),pending%(L%-1),scrcol%(L%-1)
init_vars
SHclaim%=4096
5SHtextptr%=0:SHrecptr%=0:SHheadptr%=0:SHurlptr%=0
4SHformptr%=0:SHsaveptr%=0:SHfontmenu%=0:fontM%=0
8caps%=16:filemem%()=-1:dragbutt%=0:direc%=1:userM%=0
vfirstsearch%=
:firstfilter%=
:protect%=
:force%=
:qbe%=
:valstatus%=
:clip%=
:pasting%=
:returnto%=-1:ShowTools%=
1getrec%=213:ClientSearch$="TRUE":ClientPtr%=0
RImpulse_wait%=
:merging%=
:mergenum%=0:document$="":importingcsv%=
:Run_It$=""
-mergetag%=214:transtag%=215:printtag%=216
8flash%=
:logosloaded%=
:logging%=
:acl%=
:up_pend%=
`accessbutton%=0:stop%=
:customise%=
:valtablesM%=0:indexesM%=0:undo%=
:filter%=
:reformat%=
&displayed%=-1:scratchpad$="":k$=""
oSearch$="TRUE":Filter$="TRUE":query$="ALL":SearchKey$="":REC%=-1:usekey%=-1:useval$="":ResKEY$="":ResREC%=0
greal$="":visible$="":val$="":calcfield%=0:savefunc$="":savetofile%=
:writetable%=
:writescroller%=
@password$="":pw%=0:my_ref%=-1:Type%=0:fieldtype%=1:Length%=0
Bprinting%=
:indexing%=
:not%=
:dontincrement%=
:updatethese%=
-export%=
:csvconv%=
:mergefiles%=
:OLE%=0
7autosave%=0:autobalance%=
:dupwarn%=
:duplicates%=0
$sorton%=0:sortfield%=0:nosort%=
.present%=0:fields%=0:template%=0:adjust%=
7Listed%=
:writingcsv%=
:writingtext%=
:calcerror%=
#autocsvhandle%=0:printhandle%=0
"movetype%=8:movetype$="Move
vquit%=
:exit%=
:matching%=
:newrec%=
:val%=
:ram%=
:Access%=
:Modify%=
:ramwarn%=
:altered%=
:design%=
:newtree%=
HLenLine%=0:Count%=0:labcount%=0:Printable%=0:Start%=0:End%=0:Fptr%=0
0Fieldnumber%=0:Lastwritable%=0:starthere%=-1
ALastTable%=-1:Tablenumber%=0:TabsLoaded$="Tables":table$()=""
5Rows%=0:TabFields%=0:Rec%=0:Match_tag%=1:fast%=10
WKeys%=0:keylimit%=1:keylen%=1:LH%=90:addr=-1:file%=0:key%=0:top=8*file%+LH%:RA%=100
+keyfunc$="":fieldfunc$="":Keys%=0:RU%=0
Rprintorder$="":Form$="":ImpCom$="":format$="horiz":shrink%=
:shrinkscroller%=
EFilename$="":TextName$="":extrakeys$="":extratabs$="":indexes$=""
!Days$="SunMonTueWedThuFriSat"
2Months$="JanFebMarAprMayJunJulAugSepOctNovDec"
'nonleap$="312831303130313130313031"
$leap$="312931303130313130313031"
SaveCount%=0
BScrollnum%=0:Scroller%=0:ScrollChanged%=
:Scrcol%=0:Scrcol$=""
I%=0
125
> hide%!I%=0:mandatory%!I%=0:zerolen%!I%=0:displayit%!I%=0
nosave%=
:dragfield%=0
Ecalc%=0
oldwindow%=0:oldicon%=0
dbtype$="new"
menunumber%=0:lasttype%=0
printer_palette
I%=0
wimpcol%(I%)
&ffffff00,&dedede00,&bababa00,&99999900
&78787800,&54545400,&33333333,&00000000
&ff000000,&00ffff00,&00ff0000,&0000ff00
&80eded00,&00875400,&00baff00,&ffba0000
Window handling -----------------------------------------------------
create_windows
"Wimp_OpenTemplate",,"<Pbase$Dir>.Resources.Templates"
+bannerW%=
new_window("banner",sprites%)
infoW%=
new_window("info",1)
text(infoW%,4)=progname$:$
text(infoW%,7)=version$
Tools%=1
name$="keypad"
name$="toolpane"
9keypadW%=
new_window(name$,sprites%):Title%=block%!72
zsavesubW%=
new_window("savesub",sprites%):SubName%=
text(savesubW%,2):SubSprite%=
val(savesubW%,0):SubTitle%=block%!72
UsaveW%=
new_window("save",1):SaveName%=
text(saveW%,2):SaveSprite%=
val(saveW%,0)
xaccessW%=
new_window("access",sprites%):UserID%=
text(accessW%,0):Password%=
text(accessW%,1):AccessTitle%=block%!72
passW%=
new_window("password",sprites%):Read%=
text(passW%,2):Write%=
text(passW%,3):Manager%=
text(passW%,5):LogSprite%=
val(passW%,19)
BaclW%=
new_window("aclist",sprites%):AclSprite%=
val(aclW%,15)
:mainW%=
new_window("main",sprites%):RecInfo%=block%!72
>keyW%=
new_window("keystruc",sprites%):KeyTitle%=block%!72
BchangeW%=
new_window("change",sprites%):ChangeTitle%=block%!72
'moveW%=
new_window("move",sprites%)
NtabcreateW%=
new_window("tabcreate",sprites%):tabcol%=
text(tabcreateW%,8)
$scrollW%=
new_window("scroll",0)
.numscrollW%=
new_window("scroll",sprites%)
linkW%=
new_window("link",sprites%):LinkTitle%=block%!72:Tablename%=
text(linkW%,0):fieldnum%=
text(linkW%,2):substitute%=
text(linkW%,10)
OmiscW%=
new_window("misc",1):database%=
text(miscW%,1):$database%="No data"
ic%=2
$ Date%(ic%-2)=
text(miscW%,ic%)
ic%=28
( Subfile%(ic%-28)=
text(miscW%,ic%)
Oused%=
text(miscW%,17):filesize%=
text(miscW%,18):percent%=
text(miscW%,14)
)printW%=
new_window("print",sprites%)
;matchW%=
new_window("match",sprites%):oldquery%=matchW%
'listW%=
new_window("list",sprites%)
XcreateW%=
new_window("create",sprites%):FtitleText%=block%!72:$FtitleText%="Field 0"
DescText%=
text(createW%,4):TagText%=
text(createW%,5):LenText%=
text(createW%,6):ValText%=
text(createW%,28):InsText%=
text(createW%,26)
)Fixpt%=
text(createW%,13):$Fixpt%="2"
;mintext%=
text(createW%,15):maxtext%=
text(createW%,25)
dboxX%=
text(createW%,7):boxY%=
text(createW%,8):boxW%=
text(createW%,9):boxH%=
text(createW%,10)
ArelateW%=
new_window("relation",sprites%):RelTitle%=block%!72
+reformW%=
new_window("reform",sprites%)
ReformSprite%=FNval(reformW%,0):$ReformSprite%="snew_appl;Pptr_hand,4,0;R2"
ZOriginal%=
text(reformW%,3):Reformatted%=
text(reformW%,6):Newform%=
text(reformW%,12)
RmergebaseW%=
new_window("mergebase",sprites%):MergeSprite%=
val(mergebaseW%,7)
&colW%=
new_window("cols",sprites%)
read_colours("<Pbase$Dir>.Resources.FieldCols")
VcalcW%=
new_window("calc",sprites%):CalcForm%=
text(calcW%,0):CalcTitle%=block%!72
-printerW%=
new_window("printer",sprites%)
-pselectW%=
new_window("pselect",sprites%)
2extracalcW%=
new_window("extracalcs",sprites%)
FmergeW%=
new_window("merge",sprites%):ImpulseApp%=
text(mergeW%,9)
PsizeW%=
new_window("size",sprites%):Records%=
text(sizeW%,1):$Records%="100"
/Increment%=
text(sizeW%,3):$Increment%="25"
=csvW%=
new_window("csvfile",sprites%):CSVTitle%=block%!72
<fkeyW%=
new_window("fkey",sprites%):FkeyTitle%=block%!72
7Kpadicon%=
val(fkeyW%,0):Fkeyequiv%=
text(fkeyW%,3)
)prefsW%=
new_window("prefs",sprites%)
7datesep%=
text(prefsW%,1):timesep%=
text(prefsW%,4)
.wc%=
text(prefsW%,7):ws%=
text(prefsW%,10)
mergewith%=
text(prefsW%,17)
8Interval%=
text(prefsW%,25):Every%=
text(prefsW%,32)
5StartHere%=
text(prefsW%,45):
shade(prefsW%,45,
)queryW%=
new_window("query",sprites%)
&Query%=
text(queryW%,0):$Query%=""
'helpW%=
new_window("help",sprites%)
+filterW%=
new_window("filter",sprites%)
!+searchW%=
new_window("search",sprites%)
"'gridW%=
new_window("grid",sprites%)
#CGridspace%=
text(gridW%,8):Gridsnap%=
text(gridW%,9):
grid_opts
$$informW%=
new_window("inform",0)
%'markW%=
new_window("mark",sprites%)
&TinputW%=
new_window("input",0):Prompt%=
text(inputW%,0):Params%=
text(inputW%,1)
'"titleW%=
new_window("title",0)
((mergecomW%=
new_window("mergecom",1)
"Wimp_CloseTemplate"
*Jwinbuff%()=csvW%,0,passW%,700,printerW%,1000,printW%,2300,prefsW%,3000
scroll_icons(rows%)
I%=0
rows%
iflags%=&0700F735
0Y R%=
create_icon(0,scrollW%,4,-I%*44-52,64,48,iflags%,"",buff%,writenum%,4):buff%+=4
iflags%=&0700F535
2[ R%=
create_icon(0,scrollW%,66,-I%*44-52,212,48,iflags%,"",buff%,writep%,13):buff%+=13
4#!block%=0:block%!4=-rows%*44-56
block%!8=284:block%!12=0
"Wimp_SetExtent",scrollW%,block%
new_window(name$,sp%)
handle%
"Wimp_LoadTemplate",,block%,buff%,endbuff%,fontbuff%,name$,0
,,buff%
name$="main"
block%?35=winback%
block%!64=sp%
"Wimp_CreateWindow",,block%
handle%
=handle%
show_windows
check_record
open_window(mainW%)
present%=7
Tools%=1
ShowTools%=
open_window(keypadW%)
Listed%
open_window(listW%)
store_window(wi%,buff%)
ic%,ptr%
K'!block%=wi%:block%!4=ic%:ptr%=buff%
"Wimp_GetIconState",,block%
((block%!24)
(1<<23))=0
!ptr%=block%!24:ptr%+=4
((block%?25)
1)>0
$ptr%=$
text(wi%,ic%):ptr%+=block%!36
P% !block%=wi%:ic%+=1:block%!4=ic%
"Wimp_GetIconState",,block%
restore_window(wi%,buff%)
ic%,ptr%
W'!block%=wi%:block%!4=ic%:ptr%=buff%
"Wimp_GetIconState",,block%
((block%!24)
(1<<23))=0
ZI !block%=wi%:block%!4=ic%:block%!8=!ptr%:block%!12=&ffffffff:ptr%+=4
"Wimp_SetIconState",,block%
((block%?25)
1)>0
text(wi%,ic%)=$ptr%:ptr%+=block%!36
]% !block%=wi%:ic%+=1:block%!4=ic%
"Wimp_GetIconState",,block%
open_window(wi%)
block%!0=wi%
"Wimp_GetWindowState",,block%
block%!28=-1
open_it(wi%)
open_it(wi%)
win%
wi%
mainW%:
ShowTools%
Tools%=2
update_pane(keypadW%,-154,0,152,toolheight%,0,0)
markpane%
update_pane(markW%,0,block%!16-block%!8+2,696,62,0,0)
Scrollnum%>0
design%=
I%=0
Scrollnum%-1
update_pane(scrollerW%(I%),scrolldata%(I%,1)-block%!20+2,block%!24-scrolldata%(I%,2)-scrolldata%(I%,4)+2,scrolldata%(I%,3),scrolldata%(I%,4)-4,0,0)
HasTitle%=1
uK
update_pane(titleW%,0,0,block%!12-block%!4,block%!16-block%!8,0,0)
"Wimp_OpenWindow",,block%
tabcreateW%:
update_pane(scrollW%,16,160,284,232,0,0)
pselectW%:
update_pane(numscrollW%,8,50,740,196,0,0)
matchW%:
update_pane(queryW%,340,8,466,174,0,0)
changeW%:
update_pane(queryW%,18,202,466,174,0,0)
moveW%:
update_pane(queryW%,18,312,466,138,0,0)
savesubW%:
update_pane(queryW%,10,40,466,174,0,0):
redraw_icon(wi%,0):
filterW%:
update_pane(queryW%,8,52,466,138,0,0)
keypadW%:
Tools%=1
Q !paneblock%=wi%:
"Wimp_GetWindowState",,paneblock%:flags%=paneblock%!32
flags%
(1<<19)
,
paneblock%!16-paneblock%!8>100
9 block%!4=paneblock%!4:block%!12=paneblock%!12
: block%!16=paneblock%!16:block%!8=block%!16-100
9 block%!4=paneblock%!4:block%!12=paneblock%!12
J block%!16=paneblock%!16:block%!8=block%!16-padheight%
$
"Wimp_OpenWindow",,block%
"Wimp_OpenWindow",,block%
win%=0
winbuff%(win%,0)=wi%
store_window(wi%,remember%+winbuff%(win%,1))
win%
close_it(wi%)
wi%
mainW%:
altered%
save_everything
kill_scrollers(
hide_windows:stop%=
HasTitle%>0
close_window(titleW%)
matchW%:matching%=
close_window(queryW%)
keyW%:design%=
:newtree%=
tabcreateW%:
close_window(scrollW%)
pselectW%:
close_window(numscrollW%)
changeW%,moveW%,savesubW%,filterW%:
close_window(queryW%)
close_window(wi%)
T%=0
LastTable%
wi%=tableW%(T%)
restore_caret(returnto%)
hide_windows
close_window(queryW%)
close_window(keypadW%)
I%=0
LastTable%
tableW%(I%)>0
close_window(tableW%(I%))
close_window(miscW%)
close_window(listW%)
close_window(matchW%)
close_window(relateW%)
close_window(keyW%)
close_window(reformW%)
close_window(calcW%)
close_window(mergeW%)
close_window(csvW%)
close_window(passW%)
close_window(aclW%)
close_window(tabcreateW%)
close_window(prefsW%)
close_window(printW%)
close_window(printerW%)
close_window(linkW%)
close_window(changeW%)
close_window(savesubW%)
close_window(moveW%)
close_window(searchW%)
close_window(filterW%)
close_window(helpW%)
close_window(createW%)
close_window(mainW%)
close_window(informW%)
close_window(markW%)
close_window(colW%)
close_window(inputW%)
close_window(titleW%)
close_window(extracalcW%)
close_window(wi%)
!block%=wi%
"Wimp_CloseWindow",,block%
shut_window(wi%)
"Wimp_TransferBlock",mytask%,block%,mytask%,paneblock%,88
wi%=filterW%
filter_click(filterW%,1,4)
close_it(wi%)
"Wimp_TransferBlock",mytask%,paneblock%,mytask%,block%,88
redraw(handle%)
x0%,y0%,more%
!block%=handle%
"Wimp_RedrawWindow",,block%
more%
2x0%=block%!4-block%!20:y0%=block%!16-block%!24
more%
draw(x0%,y0%)
"Wimp_GetRectangle",,block%
more%
draw(x0%,y0%)
TextPtr%,x1%,x2%,y1%,y2%,X%,Y%,line%,chars%,colour%,YS%,YL%,L%,b%,t%
handle%
titleW%:
title(SHtitleptr%,block%!4,block%!8,block%!12-block%!4,block%!16-block%!8)
mainW%:
design%
showgrid%
int%=
($Gridspace%)
$
"Wimp_SetColour",gridcol%
#
X%=x0%
block%!12
int%
X%,block%!8
plot%,X%,block%!16
#
Y%=y0%
block%!8
-int%
block%!4,Y%
plot%,block%!12,Y%
listW%:
"Wimp_SetColour",7
x1%=block%!28-x0%
x2%=block%!36-x0%
chars%=(x2%-x1%)
16+2
y1%=-(block%!40-y0%)
y2%=-(block%!32-y0%)
x1%=x1%
y1%=y1%
36+1
y2%=y2%
36+2
SHtextptr%=!textanchor%
0 TextPtr%=(SHtextptr%)+(y1%-1)*LenLine%+x1%
# RecPtr%=(SHrecptr%)+(y1%-1)*4
y2%>Count%
y2%=Count%
line%=y1%
!RecPtr%
(
-1,-2:colour%=headerwimpcol%
#
-3:colour%=rulewimpcol%
:colour%=bodywimpcol%
#
"Wimp_SetColour",colour%
!RecPtr%=-3
Q
x0%+Lmargin%*16,y0%-(line%-1)*36-18:
BY (LenLine%-Lmargin%-2)*16+8,0
draw_line
% TextPtr%+=LenLine%:RecPtr%+=4
line%
vrules%
(
"Wimp_SetColour",rulewimpcol%
G YS%=block%!8:b%=Count%*36-y0%+block%!8-fspace%:
b%<0
YS%-=b%
; YF%=block%!16:t%=hspace%+block%!24:
t%>0
YF%-=t%
L%=
(spacer$)*8
column%=2
column%<=PrintFields%
$ X%=x0%+Tab%(column%)*16-L%
"
X%,YS%:
vplot%,X%,YF%
column%+=1
draw_line
x0%+x1%*16,y0%-(line%-1)*36-4
"OS_WriteN",TextPtr%,chars%
update_pane(wi%,x%,y%,w%,h%,xs%,ys%)
newquery%=!block%
wi%=queryW%
newquery%<>oldquery%
shut_window(oldquery%):oldquery%=newquery%
&8!paneblock%=wi%:
"Wimp_GetWindowState",,paneblock%
paneblock%!4=block%!4+x%
(!paneblock%!12=paneblock%!4+w%
paneblock%!16=block%!16-y%
*!paneblock%!8=paneblock%!16-h%
+'paneblock%!20=xs%:paneblock%!24=ys%
,)paneblock%!28=block%!28:block%!28=wi%
"Wimp_OpenWindow",,paneblock%
"Wimp_OpenWindow",,block%
up_pend%
up_pend%=
"Wimp_GetWindowState",,block%
(block%!32
(1<<18))
up_pend%=
update_pane(wi%,x%,y%,w%,h%,xs%,ys%)
wi%=titleW%
close_window(wi%):
open_window(wi%)
Menu handling -------------------------------------------------------
make_menus
fieldM%=
create_menu(menu_ptr%,"Field,Create index... ^J,#14,Global changes... ^G,Link to table... ^L,Combine fields...,Start editing ^S,Remove object ,#14!saveW%,Save as CSV!saveW%,Undo changes,Compact sequence")
:8SaveOb%=
menu_text(fieldM%,7):$SaveOb%="Save object"
;fAnalyseFunc%=
menu_text(fieldM%,1):CalcFunc%=
menu_text(fieldM%,4):RemoveOb%=
menu_text(fieldM%,6)
<`validateM%=
create_menu(menu_ptr%,"Validation,Create table...,~Display table,Show files ^Q")
=fsubfilenameM%=
create_menu(menu_ptr%,"Subfile name:,^20"):Subfilename%=
menu_text(subfilenameM%,0)
>jrenameM%=
create_menu(menu_ptr%,"New name:,^255"):NewName%=
menu_text(renameM%,0):$NewName%="!NewName"
miscM%=
create_menu(menu_ptr%,"Miscellaneous,Move/delete...,Set passwords...,Field colours...,Edit template ^E,Name subfile>subfilenameM%,Rename database>renameM%")
@hdelimiterM%=
create_menu(menu_ptr%,"Separator,Comma,TAB,CR,_LF,^2"):Delim%=
menu_text(delimiterM%,4)
AzterminatorM%=
create_menu(menu_ptr%,"Terminator,CR,LF,LF CR,CR LF,CR CR,_LF LF,^2"):Termin%=
menu_text(terminatorM%,6)
B~scrolltermM%=
create_menu(menu_ptr%,"Scroll terminator,Semicolon,Comma,TAB,_Space,^1"):Scrterm%=
menu_text(scrolltermM%,4)
string$="Print,Create report... Print,Show resources ^R,Show jobs done ^P,Options... ^Print,Save query!saveW%,~Numeric fields... ^N,Extra calculations... ^
N,~Save selection!saveW%,~Clear selection ^Z,~Display selection!,Select all ^A"
D+printM%=
create_menu(menu_ptr%,string$)
EEcsvM%=
create_menu(menu_ptr%,"CSV files,Export... ^X,Options...")
FSindexM%=
create_menu(menu_ptr%,"Index,Show details... ^K,Delete,Show files ^I")
string$="Powerbase,_Information...,*Field:1234567>fieldM%,Print>printM%,Validation!validateM%,Index!indexM%,Miscellaneous>miscM%,Show keypad Tab,~Export selected!saveW%,Export subset...,Copy as!saveW%,CSV files>csvM%,_Undo changes,Help"
HImainM%=
create_menu(menu_ptr%,string$):Fieldpos%=
menu_text(mainM%,1)
indextreeM%=
create_menu(menu_ptr%,"Print index,All subfiles,Current subfile,Symmetrical,_Root first,Totals only,Complete")
tick(indextreeM%,1,
tick(indextreeM%,2,
utilityM%=
create_menu(menu_ptr%,"Utilities,~New primary key...,~Adjust format...,~New record format...,~Merge databases...,~Change length>sizeW%,~Balance index ^B,~Print index>indextreeM%,~Print field data,~Find duplicates,~Merge commands...")
LAUtil1%=
menu_text(utilityM%,1):Util2%=
menu_text(utilityM%,2)
iconbarM%=
create_menu(menu_ptr%,"\Powerbase,_Information>infoW%,New database!saveW%,*Utilities>utilityM%,~Close database,~Rename database>renameM%,Preferences...,_Help,Quit")
designM%=
create_menu(menu_ptr%,"New database,Create field...,Fields created,_Default database,Save form file!saveW%,Database size>sizeW%,_Primary key...,Grid>gridW%,Quit design"):DesAction%=
menu_text(designM%,0)
tableM%=
create_menu(menu_ptr%,"Table,Clear,Modify,Print,#15,Undo change,_Undo all,Save!saveW%,Save as CSV!saveW%"):SortTabCol%=
menu_text(tableM%,3):$SortTabCol%="Sort"
PHdirectionM%=
create_menu(menu_ptr%,"Direction,Ascending,Descending")
listM%=
create_menu(menu_ptr%,"Report,Save as text!saveW%,Sort """">directionM%,Shrink list,Discard"):SortTextCol%=
menu_text(listM%,1)
RakeystrokeM%=
create_menu(menu_ptr%,"Keystroke,Assign>fkeyW%,Defaults,Save choices,List keys")
SBmarkM%=
create_menu(menu_ptr%,"Marked record,Include,Exclude")
T`columnM%=
create_menu(menu_ptr%,"Column no.,^2"):Expcol%=
menu_text(columnM%,0):$Expcol%="1"
UzmergecomM%=
create_menu(menu_ptr%,"Merge command,GetField,GetExpanded>columnM%,NextMatch"):
tick_one(mergecomM%,0,2,0)
--------------- Read validation strings etc -----------------------
Wrfmenu$()="Editable","Computed","Check-box","External","Keypad button","Extra button","Stamp","Scrollable list"
I%=0
L% 30:flist%(I%)=L%:?L%=0
[)f$="<Pbase$Dir>.Resources.ValStrings"
vstrings%=100
vname$(vstrings%),vtype$(vstrings%),valid%(vstrings%),rvalid%(vstrings%),hvalid%(vstrings%)
valid$=
C%=
(valid$)
C%>=0
cG P%=
valid$,":"):vname$(C%)=
valid$,4,P%-4):valid$=
valid$,P%+1)
vtype$(C%)=
valid$,1)
vtype$(C%)="K"
fG !block%=keypadW%:block%!4=C%-9:
"Wimp_GetIconState",,block%
valid$=$block%!32
valid$=
valid$,3)
i
j1
(valid$)+1:$V%=valid$:valid%(C%)=V%
k2
(valid$)+1:$V%=valid$:rvalid%(C%)=V%
l5
(valid$)+16:$V%=valid$:P%=
$V%,"Pptr_")
mK
P%>0
$(V%+P%-1)="Pptr_hand,4,0"
$(V%+
($V%))=";Pptr_hand,4,0"
hvalid%(C%)=V%
vtype$(C%)
pS
"E":fmenu$(0)+=","+vname$(C%):L%=flist%(0):N%=?L%:N%+=1:?L%=N%:L%?N%=C%
qS
"C":fmenu$(1)+=","+vname$(C%):L%=flist%(1):N%=?L%:N%+=1:?L%=N%:L%?N%=C%
rS
"T":fmenu$(2)+=","+vname$(C%):L%=flist%(2):N%=?L%:N%+=1:?L%=N%:L%?N%=C%
sS
"X":fmenu$(3)+=","+vname$(C%):L%=flist%(3):N%=?L%:N%+=1:?L%=N%:L%?N%=C%
tS
"K":fmenu$(4)+=","+vname$(C%):L%=flist%(4):N%=?L%:N%+=1:?L%=N%:L%?N%=C%
uS
"O":fmenu$(5)+=","+vname$(C%):L%=flist%(5):N%=?L%:N%+=1:?L%=N%:L%?N%=C%
vS
"S":fmenu$(6)+=","+vname$(C%):L%=flist%(6):N%=?L%:N%+=1:?L%=N%:L%?N%=C%
wS
"L":fmenu$(7)+=","+vname$(C%):L%=flist%(7):N%=?L%:N%+=1:?L%=N%:L%?N%=C%
x
close_file(F)
I%=0
}IftypeM%(I%)=
create_menu(menu_ptr%,fmenu$(I%)):
tick(ftypeM%(I%),0,
ybar%=144+8*44
.Dynamicmenus%=menu_ptr%:men_top%=menu_ptr%
clear_dynamic_menus
fieldsM%=0
valtablesM%=0
userM%=0
indexesM%=0
menubuff%=menuindir%
=Dynamicmenus%
field_menu(
items%,selec%)
F%,P%,L%,D$,F$,icptr%,textpointer%,flags%
items%=-1
icptr%=
clear_dynamic_menus
;textpointer%=icptr%+(fields%+10)*24+28:$textpointer%=""
)men_top%=textpointer%+(fields%+10)*17
men_top%>men_end%
fatal_err%,"Insufficent room for field menu. Increase menumem% by at least &"+
~(men_top%-men_end%)+" bytes"
textpointer%>menu_ptr%
menu_ptr%=textpointer%
selec%=2
$icptr%="Print order"
$icptr%="Field list"
Zicptr%?12=7:icptr%?13=2:icptr%?14=7:icptr%?15=0:icptr%!16=270:icptr%!20=44:icptr%!24=0
icptr%+=28
selec%
Include all fields
F%=1
fields%
fieldmenu_item(F%)
Queriable fields only
F%=1
fields%
V%=chartype%(F%):inc%=
vtype$(V%)
"K","O":
Exclude
(
"S":inc%=(V%<>59):
Not Logo
"C","T","L":inc%=
H
"X":inc%=(V%=36
V%=39
V%=60):
Text, Text block & Remote
5
"E":inc%=(len%(F%)>0):
Not simple labels
$
inc%
fieldmenu_item(F%)
Include only highlighted fields
I%=1
(printorder$)-1
$ F%=
fnum(
printorder$,I%,2))
fieldmenu_item(F%)
Indexable fields only
F%=1
fields%
V%=chartype%(F%):inc%=
vtype$(V%)
(
"S":inc%=(V%<>59):
Not Logo
K
"C":inc%=(V%=6
V%=7):
No point indexing auto-updating fields
5
"X":inc%=(V%=60):
Remote only (pathname)
5
"E":inc%=(len%(F%)>0):
Not simple labels
$
inc%
fieldmenu_item(F%)
F%
icptr%!-24=icptr%!-24
=Dynamicmenus%
fieldmenu_item(F%)
get_icon_cols(mainW%,field%(F%))<>winback%*17
F$=
" "+
(F%)+" ",4)
7
F%>MaxFields%+2:F$+=Tag$(F%):flags%=&0B000121
<
F%=0
F%>MaxFields%:F$+=Tag$(F%):flags%=&08000121
N
text(mainW%,desc%(F%))="":F$+="<Blank> "+Tag$(F%):flags%=&07000121
5 D$=
text(mainW%,desc%(F%)),7)+" ",8)
( F$+=D$+Tag$(F%):flags%=&07000121
L%=
^ !icptr%=0:icptr%!4=-1:icptr%!8=flags%:icptr%!12=textpointer%:icptr%!16=-1:icptr%!20=L%+1
$textpointer%=F$
textpointer%+=L%+1
icptr%+=24
items%+=1
menu_text(menu%,item%)
ic%=menu%+28+item%*24
((ic%!8)
&100)=0
=ic%+12
=ic%!12
create_menu(
menu%,list$)
start%,choice$,title$,entries%,item%,P%,Q%,S%,shaded%,width%,L%,LL%,set8%,M$
start%=menu%
list$,1)="\"
leftmenu%=
list$=
list$,2)
list$,",")
$title$=
list$,P%-1):L%=
(title$)
L%>12
J !menu%=buff%:$buff%=title$:buff%+=L%+1:menu%!4=-1:menu%!8=L%:set8%=
$menu%=title$
width%=L%:M$=title$
menu%?12=7:menu%?13=2
menu%?14=7:menu%?15=0
*menu%!16=width%:menu%!20=44:menu%!24=0
item%=menu%+28
list$+=","
entries%=0
LL%=0
Q%=P%+1
P%=
list$,",",Q%)
P%>0
!item%=0:shaded%=0
choice$=
list$,Q%,P%-Q%)
S%=
choice$,"!")
5
S%>0
?item%=?item%
choice$,S%,1)=">"
S%=
choice$,">")
S%=0
item%!4=-1
S$=
choice$,S%+1)
.
S$<>""
item%!4=
(S$)
item%!4=1
choice$=
choice$,S%-1)
choice$,1)
3
"~":choice$=
choice$,2):shaded%=(1<<22)
5
"_":choice$=
choice$,2):?item%=?item%
F
"*":choice$=
choice$,2):?item%=?item%
16:shaded%=(1<<22)
-
"#":LL%=
choice$,2)):choice$=""
D
"^":LL%=
choice$,2)):choice$="":?item%=?item%
(1<<2)
C
set8%
!item%=!item%
(1<<8):set8%=
Indirected title
L%=
(choice$)+1
*
L%>width%
width%=L%:M$=choice$
LL%>0
L%=LL%+1
L%>13
LL%>0
I item%!12=buff%:$buff%=choice$:buff%+=L%:item%!16=-1:item%!20=L%
item%!8=&7000121
$(item%+12)=choice$
item%!8=&7000021
! item%!8=item%!8
shaded%
item%+=24
entries%+=1
P%=0
item%!-24=item%!-24
menu%=item%
start%!16=
string_width(M$)
=start%
tick(menu%,item%,on%)
item%=menu%+28+item%*24
on%
:?item%=?item%
:?item%=?item%
tick_one(menu%,first%,last%,item%)
I%=first%
last%
tick(menu%,I%,(I%=item%))
ticked(menu%,item%)
item%=menu%+28+item%*24
(?item%
lit(menu%,item%,on%)
item%=menu%+28+item%*24
on%
: item%!8=item%!8
(1<<22)
: item%!8=item%!8
(1<<22)
lit(menu%,item%)
item%=menu%+28+item%*24
(item%!8
(1<<22))
show_menu(menu%,x%,y%)
2)menuhandle%=menu%:menux%=x%:menuy%=y%
"Wimp_CreateMenu",,menuhandle%,x%,y%
show_pop_up_menu(menu%,wi%,ic%)
x%,y%,vxmin%,vymax%,scrollx%,scrolly%
80!block%=wi%:
"Wimp_GetWindowState",,block%
9Jvxmin%=block%!4:vymax%=block%!16:scrollx%=block%!20:scrolly%=block%!24
:;!block%=wi%:block%!4=ic%:
"Wimp_GetIconState",,block%
;=x%=block%!16-scrollx%+vxmin%:y%=block%!20-scrolly%+vymax%
<)menuhandle%=menu%:menux%=x%:menuy%=y%
"Wimp_CreateMenu",,menu%,x%,y%
show_user_menu(buff%,field%,button%)
I%,ptr%,blocksize%,menu$,F,items%,P%,m$,forbidden$,d%
whandle%=wi%:icon%=ic%
forbidden$=" $&%@\^:.#*|"
menufield%=
(Tag$(field%))
menufield%=0
Tag$(field%)<>""
menufield%+=1
H)
Tag$(menufield%)=Tag$(field%)
menufield%=field%-1
m$=Tag$(menufield%)
I%=1
P%=
forbidden$,
m$,I%,1))
P%>0
m$,I%,1)="_"
m$+="Menu"
"OS_File",5,$database%+".Menus."+m$
d%=0
"OS_File",5,$database%+"."+m$
d%=1
V*
"OS_File",8,$database%+".Menus"
WK
"OS_CLI","Rename "+$database%+"."+m$+" "+$database%+".Menus."+m$
($database%+".Menus."+m$)
F=0
softerror(m$+","+$database%,152):
#F>255
close_file(F):
softerror(m$,151):
title$=
title$="UserMenu"
button%=1
close_file(F):
"OS_CLI","Filer_Run "+$database%+".Menus."+m$:
menu$=title$+","
choice$=
menu$+=choice$+","
close_file(F)
menu$=
menu$)
P%=
menu$,",",P%+1)
P%>0
items%+=1
P%=0
blocksize%=items%*24+28
k"menu_ptr%=
clear_dynamic_menus
l(userM%=
create_menu(menu_ptr%,menu$)
show_pop_up_menu(userM%,mainW%,field%(field%))
Icon handling -------------------------------------------------------
create_icon(left%,whandle%,xmin%,ymin%,width%,height%,iconflags%,text$,d1%,d2%,d3%)
handle%
block%!0=whandle%
u!block%!4=xmin%:block%!8=ymin%
v2block%!12=xmin%+width%:block%!16=ymin%+height%
block%!20=iconflags%
d1%=0
$(block%+24)=text$
block%!24=d1%
block%!28=d2%
block%!32=d3%
"Wimp_CreateIcon",left%,block%
handle%
=handle%
string_width(S$)
Desktopfont%=0
W%=
(S$)*16+8
"Wimp_TextOp",1,S$,0
W%+=16
guess_width(chars%,type%,width%)
dontalter%
chars%=0
type%
2:S$=
chars%,"M")
4:S$="N"
chars%
1
8:S$="88"+$datesep%+"88"+$datesep%+"88"
4
10:S$="88"+$datesep%+"88"+$datesep%+"8888"
chars%,"8")
3,6,46,47,54,56,57,74,75,77,78,79:S$=
chars%,"8")
8,48,68:S$="88"+$timesep%+"88"+$timesep%+"88"
49,69:S$="Wed,09 Aug,1998"
50,70:S$="88"+$datesep%+"88"+$datesep%+"88"
51,71:S$="88"+$datesep%+"88"+$datesep%+"8888"
52,58,72:S$="Wed,09 Aug 1998.88:88:88"
53,55,73,76:S$="Wed"
0,1,7,63,64,65,66,67:S$=
chars%,"a")
:dontalter%=
dontalter%
Desktopfont%=0
width%=chars%*16+16
"
width%=
string_width(S$)
type%
"
64,65,66,67:width%+=42
=width%
redraw_icon(wi%,ic%)
!block%=wi%:block%!4=ic%
block%!8=0:block%!12=0
"Wimp_SetIconState",,block%
*block%!8=0:block%!12=wi%:block%!16=ic%
shade(wi%,ic%,on%)
icon_bit(22,wi%,ic%,on%)
icon_bit(bit%,wi%,ic%,on%)
!block%=wi%
block%!4=ic%
on%
:block%!8=0:block%!12=1<<bit%
:block%!8=1<<bit%:block%!12=1<<bit%
"Wimp_SetIconState",,block%
select(wi%,ic%)
!block%=wi%:block%!4=ic%
"block%!8=1<<21:block%!12=1<<21
"Wimp_SetIconState",,block%
deselect(wi%,ic%)
!block%=wi%:block%!4=ic%
block%!8=0:block%!12=(1<<21)
"Wimp_SetIconState",,block%
invert(wi%,ic%)
!block%=wi%:block%!4=ic%
block%!8=(1<<21):block%!12=0
"Wimp_SetIconState",,block%
set_icon(wi%,ic%,on%)
on%
select(wi%,ic%)
deselect(wi%,ic%)
selected(wi%,ic%)
!block%=wi%:block%!4=ic%
"Wimp_GetIconState",,block%
=((block%!24)
(1<<21))>0
shaded(wi%,ic%)
!block%=wi%:block%!4=ic%
"Wimp_GetIconState",,block%
=((block%!24)
(1<<22))>0
selected_esg(wi%,esg%)
"Wimp_WhichIcon",wi%,block%,&003F0000,&00200000+(esg%<<16)
=!block%
next_writable(wi%,ic%,d%,r%,wi2%,ic2%)
P%,E%,next%
"Wimp_WhichIcon",wi%,block%,&00C0E000,(14<<12)
E%+=4
block%!E%=-1
block%!P%<>ic%
P%<E%
P%+=4
P%=E%
P%-=4
r%=1
P%+4=E%
wi2%=0
r%=1
P%+4=E%
wi%=wi2%:next%=ic2%
0:P%=E%
2:P%=-4
:P%+=4*d%
wi2%>0
wi%=wi2%:next%=ic2%
next%=!block%
wi2%>0
wi%=wi2%:next%=ic2%
next%=block%!(E%-4)
:next%=block%!P%
set_caret(0,wi%,next%)
text(wi%,ic%)
!block%=wi%:block%!4=ic%
"Wimp_GetIconState",,block%
=block%!28
val(wi%,ic%)
!block%=wi%:block%!4=ic%
"Wimp_GetIconState",,block%
=block%!32
text_length(wi%,ic%)
!block%=wi%:block%!4=ic%
"Wimp_GetIconState",,block%
($(block%!28))
buffer_length(wi%,ic%)
!block%=wi%:block%!4=ic%
"Wimp_GetIconState",,block%
=block%!36-1
set_caret(pos%,wi%,ic%)
0!block%=wi%:
"Wimp_GetWindowState",,block%
((block%?34)
1)=1
ic%=-1
*
"Wimp_SetCaretPosition",wi%,ic%
-
pos%=0
pos%=
text_length(wi%,ic%)
6
"Wimp_SetCaretPosition",wi%,ic%,0,0,-1,pos%
limit_actions(off%,multi%)
multi%
12,14,15,16,17,19,20,21,-1
shade(keypadW%,ic%,off%)
buttonfield%(0,ic%)>0
shade(mainW%,field%(buttonfield%(0,ic%)),off%)
ic%=-1
lit(fieldM%,0,off%)
lit(fieldM%,2,off%)
identify_field(ic%)
/.Fieldnumber%=0:Fieldname$="":TextLength%=0
(ic%
2)=1
1! !block%=mainW%:block%!4=ic%
"Wimp_GetIconState",,block%
TextLength%=block%!36-1
Fieldnumber%=(ic%+1)
53 Fieldname$=$
text(mainW%,desc%(Fieldnumber%))
Fieldname$=""
Fieldname$=Tag$(Fieldnumber%)
selected(prefsW%,21)
8$
chartype%(Fieldnumber%)
9&
2,4:
"OS_Byte",202,0,239
:#
"OS_Byte",202,16,111
;
"OS_Byte",118
first_writable
I%+=1
(vtype$(chartype%(I%))="E"
len%(I%)>0)
I%>fields%
I%>fields%
design%=
fatal_err%,
msg("Err150")
last_writable
I%,V%,V$
I%=fields%+1
K9 I%-=1:V%=chartype%(I%):V$=vtype$(V%):ic%=field%(F%)
I%=1
((V$="E"
len%(I%)>0)
V$="L")
V$<>"E"
V$<>"L"
I%=0
Mouse_click processing ----------------------------------------------
mouse(x%,y%,b%,wi%,ic%)
T%,S%,window%,icon%
OLE%=0:cell$=""
oldx%=x%:oldy%=y%
VCblock%!0=x%:block%!4=y%:block%!8=b%:block%!12=wi%:block%!16=ic%
T%=0
LastTable%
wi%=tableW%(T%)
Tablenumber%=T%
Z!Scroller%=
scroller_num2(wi%)
"Wimp_GetCaretPosition",,block%
\"window%=!block%:icon%=block%!4
window%
mainW%,scrollerW%(Scroller%),queryW%,helpW%,changeW%,moveW%:oldwindow%=window%:oldicon%=icon%
window%<>tableW%(Tablenumber%)
oldwindow%=0:oldicon%=0
wi%
iconbar_click
infoW%:
info_click(ic%,b%)
accessW%:accessbutton%=ic%
aclW%:
mainW%:
main_click(wi%,ic%,b%)
keypadW%:
keypad_click(wi%,ic%,b%)
saveW%,savesubW%:
save_click(wi%,ic%,b%)
keyW%:
key_click(wi%,ic%,b%)
tabcreateW%:
tabcreate_click(wi%,ic%,b%)
scrollW%:
scroll_click
linkW%:
link_to_table(wi%,ic%,b%)
passW%:
passwords(x%,wi%,ic%,b%)
printW%:
print_click(wi%,printerW%,ic%,b%)
printerW%:
printer_click(printW%,wi%,ic%,b%)
matchW%:
match_click(wi%,ic%,b%)
createW%:
create_click(wi%,ic%,b%,icon%)
tableW%(Tablenumber%):
table_click(Tablenumber%)
scrollerW%(Scroller%):
scroller_click(wi%,ic%,b%,Scroller%)
changeW%:
change_click(wi%,ic%,b%)
moveW%:
move_click(wi%,ic%,b%)
listW%:
list_click(x%,y%,b%,wi%)
colW%:
set_colours(wi%,ic%,b%)
calcW%:
calc_formula(OldField%,wi%,ic%,b%,$CalcForm%)
mergeW%:
merge_click(wi%,ic%)
sizeW%:
size_click(wi%,ic%,b%)
csvW%:
csv_click(wi%,ic%,b%)
fkeyW%:
fkey_click(wi%,ic%,b%)
prefsW%:
prefs_click(wi%,ic%,b%)
queryW%:
query_click(wi%,ic%,b%)
helpW%:
help_click(wi%,ic%,b%)
reformW%:
reform_click(wi%,ic%,b%)
mergebaseW%:
mergebase_click(wi%,ic%,b%)
filterW%:
filter_click(wi%,ic%,b%)
searchW%:
search_click(wi%,ic%,b%)
gridW%:
grid_click(wi%,ic%,b%)
relateW%:
val_help
markW%:
mark_click(wi%,ic%,b%)
pselectW%:
close_it(wi%)
extracalcW%:
extra_calcs(wi%,ic%,b%)
inputW%:
input_click(wi%,ic%)
miscW%:
misc_click(wi%,ic%)
titleW%:HasTitle%=2:
close_window(wi%)
mergecomW%:
mergecom_click(wi%,ic%,b%)
bannerW%,numscrollW%:
### No action on this ###
customise%
(libfunc$+"_click(wi%,ic%,b%)")
wi%<>matchW%
wi%<>mainW%
mergecom_click(wi%,ic%,b%)
"fieldsM%=
field_menu(items%,1)
ic%
1,2:
(b%
%111)=4
z%=1
(b%
%111)=1
z%=-1
ic%=2
mergefield%+=z%
mergefield%-=z%
mergefield%>fields%
mergefield%=1
mergefield%<1
mergefield%=fields%
tick_one(fieldsM%,0,fields%-1,mergefield%-1)
show_pop_up_menu(fieldsM%,wi%,ic%)
fieldfunc$="mergecom"
show_pop_up_menu(mergecomM%,wi%,ic%)
close_window(wi%)
(b%
%11110000)>0
; Start%=
text(wi%,5):End%=Start%+
text_length(wi%,5)
. Filename$=Tag$(mergefield%):Type%=&fff
init_drag(wi%,ic%,5)
set_mergecom_icons
set_mergecom_icons
shade%
text(mergecomW%,3)=Tag$(mergefield%)
redraw_icon(mergecomW%,3)
convert_to_DDF(mergefield%)
<shade%=
(link$(mergefield%)=""
ticked(mergecomM%,1))
shade(mergecomW%,5,shade%)
shade(mergecomW%,9,shade%)
convert_to_DDF(F%)
ticked(mergecomM%,0):S$="{merge "":Powerbase GetField "+Tag$(F%)+"""}"
ticked(mergecomM%,1):S$="{merge "":Powerbase GetExpanded "+Tag$(F%)
($Expcol%)>1
S$+=","+$Expcol%
S$+="""}"
ticked(mergecomM%,2):S$="{merge "":Powerbase NextMatch""}"
text(mergecomW%,5)=S$:
redraw_icon(mergecomW%,5)
misc_click(wi%,ic%)
ic%
28,29,30,31,32,33:file%=ic%-28:
set_subfile(file%)
filemem%(file%,key%)>=0
5 addr=filemem%(file%,key%):
display(key%,addr)
"
addr=
moveto(key%,top,1)
"Wimp_StartTask","Resources:$.Apps.!Help"
print_init("W"):Lmargin%=1:LenLine%=40
end_line
store_string(
store_string("Database usage",1,
store_string(
pad("Subfile",20)+"Records Updated",1,
I%=0
(
store_string($Subfile%(I%),1,
6
store_string(
padL($
text(wi%,I%+22),6),22,
&
store_string($Date%(I%),30,
store_string("Total records used",1,
store_string(
padL($used%,6),22,
store_string("Records available",1,
store_string(
padL($Records%,6),22,
store_string("Percentage used",1,
store_string(
padL($percent%,6),23,
. $SaveName%=$database%+".PrintJobs.Stats"
/ $SaveSprite%="sfile_fff;Pptr_hand,4,0;R2"
savefunc$="Save as text"
shade(saveW%,4,
deselect(saveW%,4)
show_menu(saveW%,x%-64,y%+200)
Listed%=
close_window(wi%)
input_click(wi%,ic%)
ic%
$Params%<>""
input%=
3:cancel%=
info_click(ic%,b%)
b%=(b%
%111)
ic%
:
"XOS_ReadVarVal","Alias$URLOpen_HTTP",,-1
@
E%=0
softerror("web browser",198)
internet(Web$)
<
"XOS_ReadVarVal","Alias$URLOpen_mailto",,-1
D
E%=0
softerror("email program",198)
internet(Email$)
9
"Wimp_StartTask","Resources:$.Apps.!Help"
b%=4
"Wimp_CreateMenu",,-1
internet(url$)
var$
url$,"@")>0:var$="Open_mailto"
url$,7)<>"mailto:"
url$="mailto:"+url$
url$,7)="http://":var$="Open_HTTP"
url$,3)="www":url$="http://"+url$:var$="Open_HTTP"
:url$="http://www."+url$:var$="Open_HTTP"
Run_It$="URL"+var$+" "+url$
-block%!0=256:block%!12=0:block%!16=&4AF80
(url$)<224
$(block%+20)=url$+
B SHurlptr%=
extend_named_sliding_block(urlanchor%,SHclaim%)
: block%!20=0:block%!24=SHurlptr%:$SHurlptr%=url$+
"Wimp_SendMessage",18,block%,0:my_ref%=block%!8
grid_click(wi%,ic%,b%)
z%,space%,snap%,F
b%=(b%
%111)
1,4:
b%=4
z%=1
z%=-1
ic%
&
0:showgrid%=
selected(wi%,0)
!(
4:gridcol%=(gridcol%+1)
"4
1:gridcol%-=1:
gridcol%<0
gridcol%=15
#
$-
set_icon_cols(wi%,ic%,7+gridcol%*16)
3,4:
&!
selected_esg(wi%,1)
3:plot%=5
4:plot%=21
)
*D
5:snapgrid%=
selected(wi%,5):
shade(createW%,49,snapgrid%)
+%
"Wimp_CreateMenu",,-1
11,12:
-@ space%=
($Gridspace%):space%+=(2*z%)*((ic%=11)-(ic%=12))
.>
space%>0
$Gridspace%=
(space%):
redraw_icon(wi%,8)
13,14:
0= snap%=
($Gridsnap%):snap%+=(2*z%)*((ic%=13)-(ic%=14))
1;
snap%>0
$Gridsnap%=
(snap%):
redraw_icon(wi%,9)
3- F=
("<Pbase$Dir>.Resources.GridOpts")
4.
#F,showgrid%,snapgrid%,gridcol%,plot%
5"
#F,$Gridspace%,$Gridsnap%
close_file(F)
grid_opts
ic%>=0
redraw(mainW%)
grid_opts
F,d$
(-1)
d$="Initial"
d$="Resources"
("<Pbase$Dir>."+d$+".GridOpts")
#F,showgrid%,snapgrid%,gridcol%,plot%
#F,$Gridspace%,$Gridsnap%
close_file(F)
set_icon(gridW%,0,showgrid%)
set_icon(gridW%,5,snapgrid%)
set_icon(gridW%,3,plot%=5)
set_icon(gridW%,4,plot%=21)
set_icon_cols(gridW%,2,7+gridcol%*16)
filter_click(wi%,ic%,b%)
b%=(b%
%111)
ic%
Q'
$Query%<>""
MarkedRecs%>0
R9 $
text(wi%,5)="":
redraw_icon(wi%,5):matched%=0
Filter$=
parse
T4
check_record
addr=
moveto(key%,top,1)
U
deselect(keypadW%,22)
XF ic%=field%(buttonfield%(0,22)):
ic%>0
deselect(mainW%,ic%)
Y,
filter(keypadW%,4,
):Filter$="TRUE"
Z!
restore_caret(returnto%)
[4
close_it(wi%):
restore_caret(returnto%)
]3
deselect(matchW%,
selected_esg(matchW%,1))
select(matchW%,3)
Search$=
parse
do_it(Search$,-1)
a5 $
text(wi%,5)=
(printed%):
redraw_icon(wi%,5)
search_click(wi%,ic%,b%)
searchkey%,index$,z%,addr2,oldaddr
oldaddr=addr
index$=$
text(wi%,3)
index$<>Index$(searchkey%)
searchkey%+=1
b%=(b%
%111)
1,4:
b%=4
z%=1
z%=-1
ic%
s1 SearchKey$=
stripright($
text(wi%,1)," ")
t)
chartype%(KF%(searchkey%,0))
5,50,51,70,71:
check_date(KF%(searchkey%,0),SearchKey$,1,date$)=
SearchKey$=
transform_date(KL%(searchkey%),date$)
SearchKey$=""
w
x>
SearchKey$<>""
addr=
find(SearchKey$,searchkey%,
searchkey%<>key%
z, val$=
type(key%):kl%=
(key$(key%))
{* addr2=
search(key$(key%),key%,2)
|/
addr2<0
addr=oldaddr
addr=addr2
}
b%=4
3
close_it(wi%):
restore_caret(starthere%)
set_caret(0,wi%,1)
)
chartype%(KF%(searchkey%,0))
P
5,50,51,70,71:SearchKey$=
transform_date(KL%(searchkey%),SearchKey$)
H $
text(wi%,1)=SearchKey$:
redraw_icon(wi%,1):
set_caret(0,wi%,1)
5
close_it(wi%):
restore_caret(returnto%)
searchkey%+=z%
O
searchkey%>Keys%
searchkey%=0
searchkey%<0
searchkey%=Keys%
=
Index$(searchkey%)<>""
hide%?KF%(searchkey%,0)<>1
searchkey%-=z%
U
searchkey%>Keys%
searchkey%=0
searchkey%<0
searchkey%=Keys%
?
Index$(searchkey%)<>""
hide%?KF%(searchkey%,0)<>1
text(wi%,3)=Index$(searchkey%):
redraw_icon(wi%,3)
reform_click(wi%,ic%,b%)
I%,J%,key%
ic%
(b%
%11110000)>0
1 $Reformatted%=
force_pling($Reformatted%)
' Filename$=$Reformatted%:Type%=0
init_drag(wi%,ic%,5)
2
$Newform%=""
reformat%=1
reformat%=2
1:$Reformatted%="":
close_window(wi%):
restore_caret(returnto%)
do_reformat
mergebase_click(wi%,ic%,b%)
text(wi%,4)=
force_pling($
text(wi%,4))
Filename$=$
text(wi%,4)
(b%
%111)
1,4:
ic%
(b%
%111)=4
Filename$,".")>0
0 mergefiles%=
save(Filename$,0,0,0)
softerror("",33)
E
text(wi%,3)="":
close_it(wi%):
restore_caret(returnto%)
ic%=7
(b%
%11110000)>0
1 Type%=0:mergefiles%=
init_drag(wi%,ic%,5)
query_click(wi%,ic%,b%)
(b%
%111)
1,4:
ic%
B
"Wimp_GetCaretPosition",,block%:caretpos%=block%!20
F
2:$Query%=query$:
set_caret(0,queryW%,0):
redraw_icon(wi%,0)
$
text(helpW%,0)=""
Match_tag%=Fieldnumber%
:
Match_tag%>0
text(helpW%,0)=Tag$(Match_tag%)
5
position_window(helpW%,x%+64,y%-300,0,0,0,0)
0
set_caret(0,helpW%,6):fieldfunc$="help"
(
6,7,8,9,10,11:
invert(wi%,ic%)
prefs_click(wi%,ic%,b%)
b%=(b%
%111)
1,4:
ic%
&
12:kill%=
selected(wi%,12)
Q
shade(keypadW%,18,
selected(wi%,21)):
val_on_off(
selected(wi%,21))
W
27,28,29:
shade(wi%,25,
selected(wi%,29)):autosave%=29-
selected_esg(wi%,2)
3
set_icon(queryW%,1,
selected(wi%,30))
L
shade(wi%,32,
selected(wi%,31)):autobalance%=
selected(wi%,31)
+
34:dupwarn%=
selected(prefsW%,34)
/
(-1)
d$="Initial"
d$="Resources"
N
get_preferences(prefsW%,"<Pbase$Dir>."+d$+".Preference"):
redraw(wi%)
selected(wi%,35)
9
save_preferences(wi%,$database%+".Preference")
E
save_preferences(wi%,"<Pbase$Dir>.Resources.Preference")
b%=4
" $ImpulseApp%=$mergewith%
close_window(wi%)
present%=7
starthere%=
start_at
%
restore_caret(returnto%)
4
restore_window(wi%,remember%+winbuff%(4,1))
L
b%=4
close_window(wi%):
restore_caret(returnto%)
redraw(wi%)
H
selected(wi%,ic%)
filemem%(file%,key%)=addr
filemem%()=-1
)
auto_csv(
selected(wi%,44))
start_at
F%,X%,S$
S$=$StartHere%
(S$)>0:F%=
S$<>"":F%=
field(X%,S$,
vtype$(chartype%(F%))<>"E"
first_writable
$StartHere%=Tag$(F%)
=field%(F%)
fkey_click(wi%,ic%,b%)
z%,K$,K%,Z%
b%=(b%
%111)
1,4:
(b%
%111)=4
z%=1
z%=-1
ic%
4,5:
# K$=$Fkeyequiv%:K%=
K$,2))
ic%
4:K%+=z%
5:K%-=z%
K%=12
K%=0
K%<0
K%=11
)
K%=0
K$="None"
K$="F"+
* $Fkeyequiv%=K$:
redraw_icon(wi%,3)
# K$=$Fkeyequiv%:K%=
K$,2))
K%>0
K%>9
K%+=64
%
selected(wi%,1)
K%+=16
%
selected(wi%,2)
K%+=32
K%+=384
> Z%=
key_assigned(K%):
Z%<>-1
buttonfield%(1,Z%)=0
" buttonfield%(1,kpad%)=K%
kpad%
13,14,18:
C Z%=
key_assigned(K%+16):
Z%<>-1
buttonfield%(1,Z%)=0
* buttonfield%(1,kpad%+10)=K%+16
)
b%=4
"Wimp_CreateMenu",,-1
$
"Wimp_CreateMenu",,-1
change_click(wi%,ic%,b%)
b%=(b%
%111)
ic%
+I
changes(key%,Menufield%,$
text(changeW%,0),$
text(changeW%,1),
b%=4
close_it(wi%)
-!
restore_caret(returnto%)
.4
close_it(wi%):
restore_caret(returnto%)
move_click(wi%,ic%,b%)
b%=(b%
%111)
b%=4
z%=1
b%=1
z%=-1
ic%
:#
scycle(7,source%,-z%)
;"
scycle(7,source%,z%)
<!
scycle(8,dest%,-z%)
=
scycle(8,dest%,z%)
>v
shade(wi%,8,
shade(wi%,12,
shade(wi%,13,
shade(wi%,9,
text(wi%,1)="Move":
redraw_icon(wi%,1)
?x
shade(wi%,8,
shade(wi%,12,
shade(wi%,13,
shade(wi%,9,
text(wi%,1)="Delete":
redraw_icon(wi%,1)
@|
shade(wi%,8,
shade(wi%,12,
shade(wi%,13,
shade(wi%,9,
text(wi%,1)="Accumulate":
redraw_icon(wi%,1)
save_keys
CF
selected(wi%,5)
selected(prefsW%,15)
undo%=1
undo%=2
D-
move_records(key%,source%,dest%,top)
E addr=
moveto(key%,top,1)
F:
b%=4
close_it(wi%):
restore_caret(starthere%)
undo%
I
softerror("",142)
J
softerror("",143)
L3
load_index($database%+".PrimaryKey",0,
M# f$=$database%+".Indexes."
Keys%>0
K%=1
Keys%
P-
load_index(f$+Index$(K%),K%,
S"
blob_deleterestore("R")
T
U:
b%=4
close_it(wi%):
restore_caret(starthere%)
V4
close_it(wi%):
restore_caret(returnto%)
blob_deleterestore(A$)
F,S$,M$
($database%+".Deleted")
F>0
A$="D"
inform("",168,0)
inform("",169,0)
S$=
c1
"R":
"OS_CLI","Rename "+S$+" "+
d(
"D":
"OS_CLI","Remove "+S$
e
close_it(informW%)
close_file(F)
"OS_CLI","Delete "+$database%+".Deleted"
addr=FNmoveto(key%,top,1)
undo%=0
scycle(icon%,
file%,z%)
file%+=z%
file%<0
file%=5
file%=6
file%=0
text(moveW%,icon%)=$Subfile%(file%)
redraw_icon(moveW%,icon%)
csv_click(wi%,ic%,b%)
b%=(b%
%111)
2,4:
ic%
}2
show_pop_up_menu(delimiterM%,wi%,ic%)
~3
show_pop_up_menu(terminatorM%,wi%,ic%)
4
show_pop_up_menu(scrolltermM%,wi%,ic%)
1,4:
ic%
,
shade(wi%,4,(
selected(wi%,1)))
"
text(wi%,9)="Import"
csvfunc$
7
"ImportMain":
convert_csv($
text(wi%,13))
F
"ImportTable":
csv_to_table(Tablenumber%,$
text(wi%,13))
I
"ImportScroller":
csv_to_scroller(Scroller%,$
text(wi%,13))
%
b%=4
close_window(csvW%)
d
restore_window(wi%,remember%+winbuff%(0,1)):
b%=4
close_window(wi%)
redraw(wi%)
selected(wi%,18)
?
save_csv_options("<Pbase$Dir>.Resources.CSVoptions")
7
save_csv_options($database%+".CSVoptions")
/
(-1)
d$="Initial"
d$="Resources"
9
get_csv_options("<Pbase$Dir>."+d$+".CSVoptions")
7
selected(csvW%,24)
softerror("",132)
merge_click(wi%,ic%)
ic%
"Impulse_SendMessage",&201,":"+$mergewith%+"."+document$+" Print",,,,printtag%,mytask%
merging%=
:finished%=
$mergewith%=$ImpulseApp%
"Impulse_SendMessage",&200,":"+$mergewith%+"."+document$+" Edit Off",0,0,0,-1,mytask%
@ mergenum%=0:$
text(wi%,7)=
(mergenum%):
redraw_icon(wi%,7)
selected(queryW%,4)
direction%=-1
direction%=1
4 addr=
neighbour(key%,addr,(-direction%+1)
selected(mergeW%,12)
addr=
moveto(key%,addr,direction%)
addr=
moveto(key%,top,direction%)
merging%=
"Impulse_SendMessage",&200,":"+$mergewith%+"."+document$+" Edit On",,,,-1,mytask%
deselect(mergeW%,3)
close_file(dbasehandle%):
close_it(wi%)
merging%=
"Impulse_SendMessage",&200,":"+$mergewith%+"."+document$+" ClearMerge",,,,-1,mytask%
"Impulse_SendMessage",&200,":"+$mergewith%+"."+document$+" Edit On",,,,-1,mytask%
size_click(wi%,ic%,b%)
recs$,inc$
present%<>7
"Wimp_CreateMenu",,-1:
9recs$=
(RA%):keybase%=SHkeyptr%(0):inc$=
(keybase%!4)
b%=(b%
%111)
1,4:
ic%
($Records%)<=0:
softerror("",71)
0 $Records%=recs$:
redraw_icon(sizeW%,1)
($Increment%)<0
softerror("",72)
3 $Increment%=inc$:
redraw_icon(sizeW%,3)
(
change_length(
($Records%),
save_keys
"
"Wimp_CreateMenu",,-1
( $Records%=recs$:$Increment%=inc$
"Wimp_CreateMenu",,-1
table_click(T%)
S$,tablefield%
`NewTab%=(
table_info(T%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)="
*extra%=-NewTab%*(Rows%*(TabFields%+1))
lit(tableM%,1,NewTab%
Modify%)
$tableM%=table$(T%)
ic%>=0
( tablefield%=(ic%
(TabFields%+1))
tablefield%=0
2047
ic%<Rows%*(TabFields%+1)
" S$=$
text(tableW%(T%),ic%)
1
enter_string(S$,oldwindow%,oldicon%)
1024:
ic%<Rows%*(TabFields%+1)
Access%=
< !block%=tableW%(T%):
"Wimp_GetWindowState",,block%
Q
"Wimp_SetCaretPosition",tableW%(T%),ic%,x%-block%!4+block%!20,y%,-1,-1
asterisk(
' sort_tabcol%=ic%
(TabFields%+1)
sort_tabcol%>=0
lit(tableM%,3,Access%)
NewTab%
B h$=$
text(tableW%(T%),Rows%*(TabFields%+1)+sort_tabcol%)
% $SortTabCol%="Sort "+
h$,9)
7
$SortTabCol%="Sort column "+
(sort_tabcol%)
lit(tableM%,3,
lit(tableM%,7,
selected(passW%,13))
lit(tableM%,6,
selected(passW%,13))
show_menu(tableM%,x%-64,y%)
256:
invert(wi%,tablefield%+extra%)
@ field$=
(tablefield%):
tablefield%<10
field$="0"+field$
field$+=":"
selected(wi%,tablefield%+extra%)
printrel$(T%)+=field$
! P%=
printrel$(T%),field$)
? printrel$(T%)=
printrel$(T%),P%-1)+
printrel$(T%),P%+3)
set_icon(printW%,5,(printrel$(T%)<>""))
enter_string(S$,wi%,
ic%)
L%,ok%,scroll%,T%,N$
wi%=0
wi%
mainW%:
chartype%(Fieldnumber%)
0,1,2,3,4,63:ok%=
scrollerW%(Scroller%):ok%=
:scroll%=
:cell$=$
text(wi%,ic%)
:ok%=
ok%
buffer_length(wi%,ic%)
(S$)<=L%
# scratchpad$=$
text(wi%,ic%)
$
text(wi%,ic%)=S$
redraw_icon(wi%,ic%)
set_caret(0,wi%,ic%)
scroll%
/
scroller_press(wi%,ic%,Scroller%,13)
ScrollChanged%=
>
Moves caret to next cell. New row if Shift pressed
$
softerror(""""+S$+"""",7)
scroll_click
(b%
%111)=2
row%=(ic%
"0$tabcol%=
(row%):
redraw_icon(tabcreateW%,8)
list_click(x%,y%,b%,wi%)
F%,N%,line%,xpos%,column%,last%
!block%=wi%
"Wimp_GetWindowState",,block%
).line%=((block%!16-block%!24-y%+36)
36)-1
*&xpos%=(x%-block%!4+block%!20)
xpos%<Lmargin%
xpos%>LenLine%-3
format$="horiz"
column%+=1
/4
Tab%(column%)>xpos%
column%=PrintFields%+1
column%-=1
1% F%=
fnum(
Form$,column%*2-1,2))
(b%
%111)
chartype%(F%)
62
5,50,51,70,71,53,55,73,76:sortfield%=F%
:sortfield%=0
9: $SortTextCol%="Sort "+Tag$(F%):sort_textcol%=column%
:2
lit(listM%,1,(format$="horiz")
nosort%)
;!
show_menu(listM%,x%-64,y%)
1,4:
SHrecptr%=!recanchor%
R%=SHrecptr%!(line%*4)
last%=
(Form$)
@(
R%<RA%
R%>=0
check_record
A$ addr=
find("#"+
(R%),key%,
format$="vert"
N%+=1:line%-=1
E.
SHrecptr%!(line%*4)<>R%
N%=last%
F( F%=
fnum(
Form$,N%*2-1,2))
G
F%>0
F%<=fields%
I$
vtype$(chartype%(F%))
J,
"E":
restore_caret(field%(F%))
"L":
L# S%=
scroller_number(F%)
M*
set_caret(0,scrollerW%(S%),0)
N(
restore_caret(starthere%)
P
(b%
%111)=4
open_window(mainW%)
F%>0
UL !block%=mainW%:block%!4=desc%(F%):
"Wimp_GetIconState",,block%
VJ xmin%=block%!8:ymin%=block%!12:xmax%=block%!16:ymax%=block%!20
W> block%!4=field%(F%):
"Wimp_GetIconState",,block%
X> w%=block%!16-block%!8+16:h%=block%!20-block%!12+16
Y4 scrollx%=block%!8-8:scrolly%=block%!20+8
[E
xmax%<block%!8:w%=block%!16-xmin%+16:scrollx%=xmin%-8
\4
xmin%>block%!16:w%=xmax%-block%!8+16
]5
ymax%<block%!12:h%=block%!20-ymin%+16
^F
ymin%>block%!20:h%=ymax%-block%!12+16:scrolly%=ymax%+8
`T
position_window(mainW%,x%-(w%
2),y%-(h%
2),w%,h%,scrollx%,scrolly%)
b
match_click(wi%,ic%,b%)
not%,and%,or%
b%=(b%
%111)
selected_esg(matchW%,1)=8
k#
selected_esg(printW%,4)
l!
22:reportdest$="Window"
23:reportdest$="File"
n"
25:reportdest$="Printer"
reportdest$="Window"
ic%
u&
selected(wi%,ic%),
w+
deselect(wi%,
selected_esg(wi%,1))
x,
select(wi%,8):$
text(wi%,0)="Print"
y5
close_it(wi%):
restore_caret(starthere%)
(-1)
|@ Search$="":displayed%=REC%:leaf$=
key$(0),NameLength%)
~A Search$=
query:displayed%=-1:leaf$=
query$,NameLength%)
D $Query%="":
redraw_icon(queryW%,0):
set_caret(0,queryW%,0)
E TextName$=$database%+".PrintJobs."+leaf$:$SaveName%=TextName$
reportdest$
"Window","Printer":
$
do_it(Search$,displayed%)
"File":
savefunc$="Save list"
3 $SaveSprite%="sfile_fff;Pptr_hand,4,0;R2"
0
shade(saveW%,4,
deselect(saveW%,4)
.
position_window(saveW%,0,0,0,0,0,0)
set_caret(0,saveW%,2)
M
b%=4
selected(wi%,8)
close_it(wi%):
restore_caret(starthere%)
b%=4
fieldfunc$="getcalc"
9 fieldsM%=
field_menu(items%,2+(printorder$=""))
-
show_pop_up_menu(fieldsM%,wi%,ic%)
3,8,9,10:
!
selected_esg(wi%,1)
3:S$="Count"
8:S$="Print"
9:S$="Mark"
10:S$="Clear"
, $
text(wi%,0)=S$:
redraw_icon(wi%,0)
&
shade(wi%,4,
selected(wi%,8))
&
shade(wi%,6,
selected(wi%,8))
'
shade(wi%,12,
selected(wi%,8))
2
position_window(printW%,0,0,0,0,0,0)
6
update_selection(
selected(wi%,ic%),"00")
6
update_selection(
selected(wi%,ic%),"KK")
7
update_selection(
selected(wi%,ic%),"SF")
ic%=7
fieldfunc$="getcalc"
7 fieldsM%=
field_menu(items%,2+(printorder$=""))
+
show_pop_up_menu(fieldsM%,wi%,ic%)
mark_click(wi%,ic%,b%)
b%=(b%
%111)
1,4:
ic%
selected(wi%,0)
* SHmarkptr%?REC%=1:MarkedRecs%+=1
,
SHmarkptr%?REC%=0:MarkedRecs%-=1
clear_marks(RA%)
6
b%=4
show_pop_up_menu(markM%,wi%,ic%)
ic%=2
show_pop_up_menu(markM%,wi%,ic%)
warn_of_marks
warn_of_marks
MarkedRecs%>0
shade(markW%,1,
ticked(markM%,0)
set_icon_cols(queryW%,5,7+16*10)
ticked(markM%,1)
set_icon_cols(queryW%,5,7+16*11)
set_icon_cols(queryW%,5,7+16)
shade(markW%,1,
help_click(wi%,ic%,b%)
new$,I%,L%,tag$,item$
butt%=(b%
%111)
z%=(butt%=1)-(butt%=4)
butt%
2,4:
ic%=19
% tag$=$
text(wi%,0):L%=
(tag$)
& fieldsM%=
field_menu(items%,1)
( item$=$
menu_text(fieldsM%,I%)
I%+=1
%
item$,L%)=tag$
I%>items%
)
tick_one(fieldsM%,0,items%,I%-1)
+
show_pop_up_menu(fieldsM%,wi%,ic%)
butt%
1,4:
ic%
1:new$="NOT (":not%=
9:new$=" AND "
10:new$=" OR "
16,17:
S Match_tag%=
find_next_valid_field(Match_tag%,"help",z%*((ic%=16)-(ic%=17)))
J
Match_tag%>0
text(wi%,0)=Tag$(Match_tag%)
text(wi%,0)=""
redraw_icon(wi%,0)
C
21:$Query%="":
redraw_icon(queryW%,0):
set_caret(0,wi%,6)
op%=
selected_esg(wi%,1)
op%
2:op$="="
3:op$="{"
4:op$="<"
5:op$=">"
11:op$="<>"
13:op$=">="
14:op$="<="
15:op$="}{"
22:op$="{{"
tag$=$
text(wi%,0)
contents$=$
text(wi%,6)
new$=tag$+op$+contents$
6
close_it(helpW%):
set_caret(0,queryW%,0)
new$<>""
"Wimp_GetCaretPosition",,block%
handle%=!block%
handle%=queryW%
enter_tag(new$)
/
$Query%+=new$:
redraw_icon(queryW%,0)
not%=
$Query%)<>")"
$Query%+=")":not%=
redraw_icon(queryW%,0)
iconbar_click
%111
position_window(prefsW%,0,0,0,0,0,0)
selected(passW%,12)
close_window(saveW%)
)
show_menu(iconbarM%,x%-64,ybar%)
$dbase%="No data"
$SaveName%="!DataBase"
1 $SaveSprite%="snew_appl;Pptr_hand,4,0;R2"
savefunc$="New database"
B $
text(saveW%,4)="":
shade(saveW%,4,
deselect(saveW%,4)
.
"Wimp_CreateMenu",,saveW%,x%-50,440
show_windows
update_external(REC%)
chartype%(OLE%)
show_text_block(OLE%,REC%)
show_picture(OLE%,REC%)
redraw_icon(mainW%,field%(OLE%))
restore_caret(returnto%)
restore_caret(ic%)
Access%
ic%=-1
ic%=starthere%
ic%>=0
$
set_caret(0,mainW%,ic%)
identify_field(ic%)
main_click(wi%,ic%,b%)
P%,F%,H$,L%,T%,N$,field$,V%,char%
exit%
present%=7
adjust%=
validate(Fieldnumber%,T%,N$)=
changed%=
update_calcs(Fieldnumber%)
flash%
set_icon(wi%,field%(flash%),state%):flash%=
present%
0,3:
design_field(b%,ic%,
first_writable>0
default_key
design_field(b%,ic%,
5,7:
adjust%
design_field(b%,ic%,
7
identify_field(ic%)
9d
b%<>2
(Fieldnumber%=0
Fieldnumber%>fields%)
char%=-1
char%=chartype%(Fieldnumber%)
:,
selected(prefsW%,19)
relations
2047
char%
>D
show_user_menu(menubuff%,Fieldnumber%,(b%
%111))
?g
9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31:
fkey_status(char%-9)
A!
close_window(saveW%)
B.
selected(passW%,11)
Modify%
C
set_up_field_menu
D)
show_menu(mainM%,x%-64,y%)
char%
ID
customise%
(libfunc$+"_button(wi%,ic%,b%)")
Jq
0,1,2,3,4,5,6,7,8,39,46,47,48,49,50,51,52,53,54,55,56,57,58,63,68,69,70,71,72,73,74,75,76,77,78,79:
K.
"Wimp_GetCaretPosition",,block%
first%=
find_caret
M0
select_range(first%,Fieldnumber%,
Nk
9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30:
keypad_click(wi%,char%-9,1)
Om
check_record
invert(wi%,ic%):
filter(wi%,b%,
selected(wi%,field%(buttonfield%(0,22))))
RK
(-2):displayit%?Fieldnumber%=(displayit%?Fieldnumber%)
T* col%=
get_icon_cols(wi%,ic%)
U6 col%=((col%>>4)
(col%<<4))
%11111111
V*
set_icon_cols(wi%,ic%,col%)
W' boxon%=((col%
%1111)<2)
X*
update_selection(boxon%,"")
ZY
37,38:
(-2):displayit%?Fieldnumber%=(displayit%?Fieldnumber%)
1
41,42,43,61,62:
\( col%=
get_icon_cols(wi%,ic%)
]4 col%=((col%>>4)
(col%<<4))
%11111111
^(
set_icon_cols(wi%,ic%,col%)
_% boxon%=((col%
%1111)<2)
`(
update_selection(boxon%,"")
aD
show_user_menu(menubuff%,Fieldnumber%,(b%
%111))
cc
link$(Fieldnumber%)=""
softerror("",188)
softerror(
link$(Fieldnumber%),2),186)
ec
link$(Fieldnumber%)=""
softerror("",188)
softerror(
link$(Fieldnumber%),2),187)
(-1):
i_
$Rf%(Fieldnumber%)=""
softerror("",188)
softerror($Rf%(Fieldnumber%),165)
jK
(-2):displayit%?Fieldnumber%=(displayit%?Fieldnumber%)
l* col%=
get_icon_cols(wi%,ic%)
m6 col%=((col%>>4)
(col%<<4))
%11111111
n*
set_icon_cols(wi%,ic%,col%)
o' boxon%=((col%
%1111)<2)
p4
update_selection(boxon%,"")
char%
uD
customise%
(libfunc$+"_button(wi%,ic%,b%)")
v.
internet($Rf%(Fieldnumber%))
wk
9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30:
keypad_click(wi%,char%-9,4)
xm
check_record
invert(wi%,ic%):
filter(wi%,b%,
selected(wi%,field%(buttonfield%(0,22))))
y?
selected(passW%,14)
match(x%-396,y%-131)
zD
show_user_menu(menubuff%,Fieldnumber%,(b%
%111))
{(
check_record
~4
(-2):
enter_tag(Tag$(Fieldnumber%))
.
edit_blob(Fieldnumber%,char%)
8
37,38,39,40:
edit_blob(Fieldnumber%,char%)
41,42,43:
4
(-2):
enter_tag(Tag$(Fieldnumber%))
Access%:
invert(wi%,ic%)
S
selected(wi%,ic%)
$Rf%(Fieldnumber%)=" "
$Rf%(Fieldnumber%)=""
61,62:
4
(-2):
enter_tag(Tag$(Fieldnumber%))
Access%:
5 V%=
val(wi%,ic%):P%=
$V%,";S"):V%+=P%+1
$V%
D
"null","dontcare":$V%="yes":$Rf%(Fieldnumber%)=" "
8
"yes":$V%="no":$Rf%(Fieldnumber%)=
"no":
8
char%=61
$V%="null"
$V%="dontcare"
% $Rf%(Fieldnumber%)=""
#
redraw_icon(wi%,ic%)
:
Access%
quit%=
check_record
quit%=
,
execute_file(Fieldnumber%)
+
link$(Fieldnumber%),1)="@"
* dir$=
link$(Fieldnumber%),2)
0 dir$=
filename(dir$,"PrintRes",-1)
V
"OS_CLI","Filer_OpenDir "+dir$+" "+
(oldx%)+" "+
(oldy%)+" "+dirdisp$
!
softerror("",91)
4
(-2):
enter_tag(Tag$(Fieldnumber%))
.
get_remote_file(Fieldnumber%)
(-1)
#
lookup(Fieldnumber%)
3
relations:
tone_dial(Fieldnumber%)
char%
w
0,1,2,3,4,5,6,7,8,39,46,47,48,49,50,51,52,53,54,55,56,57,58,63,68,69,70,71,72,73,74,75,76,77,78,79:
\
Access%
hide%?Fieldnumber%=0
dragfield%=Fieldnumber%:
init_drag(wi%,ic%,5)
256:
char%
q
0,1,2,3,4,5,6,7,8,39,46,47,48,49,50,51,52,53,54,55,56,57,58,63,68,69,70,71,72,73,74,75,76,77,78,79:
n
get_icon_cols(wi%,ic%)<>winback%*17
invert(wi%,ic%):
update_selection(
selected(wi%,ic%),"")
vtype$(char%)="E"
D
find_caret=0
get_icon_cols(wi%,ic%)<>winback%*17
: !block%=wi%:
"Wimp_GetWindowState",,block%
[
Access%
"Wimp_SetCaretPosition",wi%,ic%,x%-block%!4+block%!20,y%,-1,-1
1024:
(-2)
char%
s
0,1,2,3,4,5,6,7,8,39,46,47,48,49,50,51,52,53,54,55,56,57,58,63,68,69,70,71,72,73,74,75,76,77,78,79:
,
enter_tag(Tag$(Fieldnumber%))
!
vtype$(char%)="E"
6
get_icon_cols(wi%,ic%)<>winback%*17
< !block%=wi%:
"Wimp_GetWindowState",,block%
]
Access%
"Wimp_SetCaretPosition",wi%,ic%,x%-block%!4+block%!20,y%,-1,-1
&
user_menu(Fieldnumber%)
user_menu(F%)
I%,M%
selected(prefsW%,49)
I%+=1
chartype%(I%)=33
Tag$(I%)=Tag$(F%)
M%=I%
M%>0
I%=fields%
M%>0
show_user_menu(menubuff%,M%,4)
"Wimp_CreateMenu",,-1
selected(prefsW%,19)
relations
find_caret
wi%,ic%,S%,F%
"Wimp_GetCaretPosition",,block%
wi%=!block%:ic%=block%!4
scroller_num2(wi%)
wi%
mainW%:F%=((block%!4)+2)
scrollerW%(S%):F%=scrolldata%(S%,0)
tone_dial(F%)
-f$="<Pbase$Dir>.Resources.Dial "+$Rf%(F%)
"OS_File",5,f$
d%=0
phone(F%)
>DialDelay%
$Rf%(F%)<>""
"OS_CLI","Run "+f$
phone(F%)
D$,T$
text(mainW%,desc%(F%)))
u(Tag$(F%))
D$,"TEL")>0
T$,"TEL")>0)
enter_tag(tag$)
wi%,S$
"Wimp_GetCaretPosition",,block%
+wi%=!block%:ic%=block%!4:pos%=block%!20
wi%
queryW%,helpW%,calcW%,extracalcW%:
S$=$
text(wi%,ic%)
# S$=
S$,pos%)+tag$+
S$,pos%+1)
text(wi%,ic%)=S$
set_caret(pos%+
(tag$),wi%,ic%)
redraw_icon(wi%,ic%)
set_up_field_menu
I%,tabmen%,V%
tabmen%=(LastTable%<>-1)
tabmen%
make_table_menu(TabsLoaded$):
tick_one(valtablesM%,0,LastTable%,LastTable%+1)
V%=chartype%(Fieldnumber%)
I%=0
lit(fieldM%,I%,
$AnalyseFunc%="Analyse"
Fieldnumber%>0
get_icon_cols(wi%,ic%)<>winback%*17
Menufield%=Fieldnumber%
lit(mainM%,1,
E $Fieldpos%="Field: "+Tag$(Fieldnumber%):Menufield%=Fieldnumber%
& $LinkTitle%="Field: "+Fieldname$
> $CalcForm%=Tag$(Fieldnumber%)+"=":
redraw_icon(calcW%,0)
5,50,51,70,71:
$ isadate%=
lit(fieldM%,1,
& $AnalyseFunc%="Analyse months"
:isadate%=
is_a_key(Fieldnumber%)>=0
lit(fieldM%,1,
_
isadate%=
selected(mainW%,field%(Fieldnumber%))
$AnalyseFunc%="Analyse index"
0,1,2,3,4,5,8,63:
lit(fieldM%,0,Access%)
lit(fieldM%,2,Access%)
!)
lit(fieldM%,3,Access%
tabmen%)
lit(fieldM%,5,Access%)
lit(fieldM%,9,
set_up_key_window
%* $ChangeTitle%="Field: "+Fieldname$
&3 $
text(changeW%,0)="":$
text(changeW%,1)=""
link_status
6,7:
lit(fieldM%,0,Modify%)
lit(fieldM%,4,Modify%)
+T
V%=6
calc_link("Calculations...",6)
calc_link("Combine fields...",7)
set_up_key_window
-H
41,42,43,61,62:
lit(fieldM%,2,Modify%):
lit(fieldM%,9,Modify%)
.4
46,47,48,49,50,51,52,53,54,55,56,57,58,79:
V%=47
0!
lit(fieldM%,4,Modify%)
1"
lit(fieldM%,10,Modify%)
2,
calc_link("Set base value...",47)
3
lit(fieldM%,0,Access%)
set_up_key_window
36,39:
7D
blob_path(
,$database%,REC%,Fieldnumber%,V%,object$)>=0
8' $RemoveOb%="Remove text file"
9# $SaveOb%="Save text file"
:!
lit(fieldM%,6,Access%)
;.
lit(fieldM%,7,
selected(passW%,13))
<5 $SaveName%=$database%+".PrintJobs.TextFile"
=3 $SaveSprite%="sfile_fff;Pptr_hand,4,0;R2"
savefunc$="Save text"
?
37,40:
AD
blob_path(
,$database%,REC%,Fieldnumber%,V%,object$)>=0
B$ $RemoveOb%="Remove sprite"
C $SaveOb%="Save sprite"
D!
lit(fieldM%,6,Access%)
E.
lit(fieldM%,7,
selected(passW%,13))
F3 $SaveName%=$database%+".PrintJobs.Sprite"
G3 $SaveSprite%="sfile_ff9;Pptr_hand,4,0;R2"
H! savefunc$="Save sprite"
I
KD
blob_path(
,$database%,REC%,Fieldnumber%,V%,object$)>=0
L& $RemoveOb%="Remove drawfile"
M" $SaveOb%="Save drawfile"
N!
lit(fieldM%,6,Access%)
O.
lit(fieldM%,7,
selected(passW%,13))
P5 $SaveName%=$database%+".PrintJobs.DrawFile"
Q3 $SaveSprite%="sfile_aff;Pptr_hand,4,0;R2"
savefunc$="Save draw"
S
T"
35:
U% $RemoveOb%="Unlink directory"
$SaveOb%="Save object"
W;
link$(Fieldnumber%)<>""
lit(fieldM%,6,Access%)
Y $RemoveOb%="Unlink file"
$SaveOb%="Save object"
[;
link$(Fieldnumber%)<>""
lit(fieldM%,6,Access%)
] $RemoveOb%="Unlink file"
$SaveOb%="Save object"
_"
$Rf%(Fieldnumber%)<>""
`9
lit(fieldM%,6,Access%):
lit(fieldM%,7,Access%)
a. $SaveName%=
leaf($Rf%(Fieldnumber%))
bK S$=$
val(mainW%,field%(Fieldnumber%)):P%=
S$,";S"):spr$=
S$,P%+1)
c/ $SaveSprite%=spr$+";Pptr_hand,4,0;R2"
savefunc$=$SaveOb%
e
lit(fieldM%,0,Access%)
lit(fieldM%,2,Access%)
set_up_key_window
i* $ChangeTitle%="Field: "+Fieldname$
j3 $
text(changeW%,0)="":$
text(changeW%,1)=""
64,65,66,67:
l" $Fieldpos%+="#"+
(Scrcol%)
m)
lit(fieldM%,3,Access%
tabmen%)
link_status
$RemoveOb%="Blank list"
$SaveOb%="Save as list"
lit(fieldM%,8,Access%)
rD
blob_path(
,$database%,REC%,Fieldnumber%,V%,object$)>=0
s!
lit(fieldM%,6,Access%)
t.
lit(fieldM%,7,
selected(passW%,13))
u< $SaveName%=$database%+".PrintJobs."+
leaf(object$)
v
x@ $
text(saveW%,4)="":
shade(saveW%,4,
deselect(saveW%,4)
lit(mainM%,1,
):$Fieldpos%="Field: """""
set_up_key_window
I%,J%
I%=0
keyfield%(I%)=0
J%=12
$
text(keyW%,4*I%+J%)=""
keyfield%(0)=Fieldnumber%
text(keyW%,12)=Tag$(Fieldnumber%)
text(keyW%,14)="L"
text(keyW%,15)=
(len%(Fieldnumber%))
-keylimit%=TextLength%:$
text(keyW%,29)=""
keylen%=keylimit%
update_selection(add%,field$)
P%,SP%,F%,SF%
"F%=Fieldnumber%:SF%=(F%
128)
field$=""
/ field$=
~(F%):
F%<16
field$="0"+field$
4 sfield$=
~(SF%):
SF%<16
sfield$="0"+sfield$
add%
(-1)
chartype%(F%)
%
36,39:printorder$+=field$
:printorder$+=sfield$
printorder$+=field$
enable_row(calcrow%?Fieldnumber%,
lit(printM%,7,
lit(printM%,8,
lit(mainM%,7,
selected(passW%,13))
$ P%=
printorder$,field$,P%+1)
((P%-1)
2)=0
P%=0
P%>0
9 printorder$=
printorder$,P%-1)+
printorder$,P%+2)
,
enable_row(calcrow%?Fieldnumber%,
) SP%=
printorder$,sfield$,SP%+1)
!
((SP%-1)
2)=0
SP%=0
SP%>0
= printorder$=
printorder$,SP%-1)+
printorder$,SP%+2)
.
enable_row(calcrow%?Fieldnumber%,
printorder$=""
lit(printM%,7,
lit(printM%,8,
lit(mainM%,7,
shade(matchW%,7,printorder$<>"")
lit(printM%,9,printorder$<>"")
print_click(wi%,wi2%,ic%,b%)
d$,fg%,bg%,colour%,z%
b%=(b%
%111)
selected(wi%,26)
show_menu(wi2%,x%-500,y%+200)
1,4:
b%=4
z%=1
z%=-1
ic%
5
15,16:
deselect(wi2%,
selected_esg(wi2%,2))
#
22,23,25:
set_dest_sprite
'
ic%<>25
close_window(wi2%)
-
deselect(wi2%,
selected_esg(wi2%,2))
3
selected_esg(wi%,3)=-1
select(wi%,15)
40,41:
(
shade(wi%,43,
selected(wi%,40))
(
shade(wi%,51,
selected(wi%,40))
$
text(wi2%,0)=pdriver$
*
position_window(wi2%,0,0,0,0,0,0)
/
(-1)
d$="Initial"
d$="Resources"
K
get_options(wi%,wi2%,"<Pbase$Dir>."+d$+".!PrintOpts"):
redraw(wi%)
P
b%=4
close_window(wi%):
restore_caret(returnto%)
match(0,0)
4
restore_window(wi%,remember%+winbuff%(3,1))
L
b%=4
close_window(wi%):
restore_caret(returnto%)
redraw(wi%)
selected(wi%,31)
D
save_options(wi%,wi2%,"<Pbase$Dir>.Resources.!PrintOpts")
C
prtopts$=""
prtopts$=$database%+".PrintRes.PrintOpts"
$SaveName%=prtopts$
3 $SaveSprite%="sfile_7f5;Pptr_hand,4,0;R2"
, $
text(saveW%,4)="Default options"
6
shade(saveW%,4,
deselect(saveW%,4)
" savefunc$="Save options"
%
show_menu(saveW%,x%-64,y%)
53,54,55:
I colour%=
get_icon_cols(wi%,ic%):fg%=colour%
16:bg%=colour%
fg%=(fg%+z%+16)
> colour%=fg%+bg%*16:
set_icon_cols(wi%,ic%,colour%)
enable_print_setup(wi%,wi2%)
set_dest_sprite
Z$,sprite$,wi%
wi%=printW%
selected_esg(wi%,4)
22:sprite$="Swin2"
23:sprite$="Ssmall_fff"
25:sprite$="Sprinter"
val(matchW%,11)=sprite$+";R2"
redraw_icon(matchW%,11)
shade(wi%,42,
selected(wi%,25))
selected(wi%,25)
shade(matchW%,11,
printer_driver(Z$))
shade(matchW%,11,
printer_driver(
driver$)
xres%,yres%
:driver$=
msg("Err180"):=
"PDriver_Info"
,xres%,yres%,,driver$
(driver$+=" "+
(xres%)+" x "+
(yres%)
printer_click(wi%,wi2%,ic%,b%)
copies%,z%
b%=(b%
%111)
1,4:
b%=4
z%=1
z%=-1
ic%
!
38,48,77:
convert_units
1
7,8:
deselect(wi%,
selected_esg(wi%,3))
H
ic%=8
deselect(wi2%,
selected_esg(wi2%,9)):
select(wi2%,80)
g
restore_window(wi2%,remember%+winbuff%(2,1)):
b%=4
close_window(wi2%)
redraw(wi2%)
)
b%=4
close_window(wi2%)
44,47:
" copies%=
text(wi2%,45))
,
ic%=47
copies%+=z%
copies%-=z%
-
copies%=0
copies%=100
copies%=1
" $
text(wi2%,45)=
(copies%)
redraw_icon(wi2%,45)
59,72:
>
"Font_ListFonts",,0,(1<<19),,0
,,,size%,,indsize%
SHfontmenu%=0
G SHfontmenu%=
extend_named_sliding_block(fontanchor%,SHclaim%)
?
SHfontmenu%=
claim_page(fontanchor%,size%+indsize%)
fontM%=SHfontmenu%
G
"Font_ListFonts",,fontM%,(1<<19),size%,fontM%+size%,indsize%
*
show_pop_up_menu(fontM%,wi2%,ic%)
"
ic%=59
fontdisplay%=57
"
ic%=72
fontdisplay%=71
B
61,62,63,64,84:
shade(wi2%,65,(
selected_esg(wi2%,7)<0))
enable_print_setup(wi%,wi2%)
enable_print_setup(wi%,wi2%)
live%()=42,-1:
'Lots more'
enable(wi%,
selected(wi%,25)):
Printer dest
selected_esg(wi%,3)=-1
selected_esg(wi2%,2)=-1
select(wi%,15)
selected(wi%,16)
selected(wi2%,8)
deselect(wi%,46)
+$live%()=46,-1:
Enable 'Sort on'
enable(wi%,
selected(wi%,15)
selected(wi2%,7)):
Horiz or Table
--live%()=44,47,-1:
Sort field & direction
enable(wi%,
selected(wi%,46)):
Sort on switch set
/9live%()=43,51,-1:
Shrink row switch & Row terminator
enable(wi%,
selected(wi%,40)):
Single row format set
1+live%()=65,-1:
User-defined point-size
enable(wi2%,
selected_esg(wi2%,7)=-1):
No fixed size selected
3&live%()=68,-1:
Margins as printer
enable(wi2%,
printer_driver(pdriver$))
5$live%()=14,15,16,18,-1:
Margins
enable(wi2%,
selected(wi2%,68))
7>live%()=23,24,69,-1:
Enable extra cols, width, extra rows
enable(wi2%,
selected(wi2%,7)):
Table
92live%()=80,81,85,86,-1:
Disable print-columns
enable(wi2%,
selected(wi2%,8)):
Label
live%()=82,-1:
Gutter
enable(wi2%,
selected_esg(wi2%,9)>80):
2,3 or 4 cols selected
=2live%()=28,29,30,31,32,34,39,41,51,52,53,55,-1
enable(wi2%,
selected(wi2%,8)):
Enable special label settings
?3live%()=40,78,-1:
Enable substitution on label
selected(wi2%,8)
deselect(wi2%,39)
enable(wi2%,
selected(wi2%,8)
selected(wi2%,39)):
Subst.switch set
keypad_click(wi%,ic%,b%)
handle%,icon%,T%,flag%,N$,date$,retry%
validate(Fieldnumber%,T%,N$)=
G(changed%=
update_calcs(Fieldnumber%)
ic%<>1
HasTitle%=1
close_window(titleW%):HasTitle%=2
ic%
18,20,21:flag%=
Allow table listing & scratchpad operations
:flag%=
check_record
retry%
flag%
deselect(wi%,22):Filter$="TRUE":
close_window(relateW%)
flash%
set_icon(mainW%,field%(flash%),state%):flash%=
b%=(b%
%111)
fkey_status(ic%)
1,4:
b%=4
z%=1
z%=-1
ic%
W6
merging%
scan(z%,
text(wi%,23)))
b%=1
Z:
HasTitle%=2
HasTitle%=1:
open_window(mainW%)
stop%=
\
]%
2:addr=
moveto(key%,top,z%)
^&
3:addr=
moveto(key%,top,-z%)
_&
4:addr=
moveto(key%,addr,z%)
`'
5:addr=
moveto(key%,addr,-z%)
a(
6:addr=
fast_wind(top,addr,z%)
b)
7:addr=
fast_wind(top,addr,-z%)
key_select(z%)
key_select(-z%)
subfile(z%)
subfile(-z%)
g-
rotate:addr=
moveto(key%,top,1)
h"
allow_search(wi%,z%)
i<
b%=4
display(key%,-1)
display(key%,-2)
j#
15:addr=
shift(z%,key%,0)
(-1)
l! filemem%(file%,key%)=-1
m( addr=
find("#"+
(REC%),key%,
display(key%,addr)
o
p$
16:addr=
shift(-z%,key%,0)
(-1)
r! filemem%(file%,key%)=-1
s( addr=
find("#"+
(REC%),key%,
display(key%,addr)
u
v6
17:addr=
shift(0,key%,1):
display(key%,addr)
val_help
save_everything
store
z#
retrieve(scratchpad$)
{/
filter(wi%,b%,
selected(wi%,ic%))
24,25,26,27:
~
text(wi%,ic%)=""
R$=$
text(wi%,ic%)
G
R$=""
text(wi%,ic%)=
(REC%)
addr=
find("#"+R$,key%,
redraw_icon(wi%,ic%)
=
customise%
(libfunc$+"_button(wi%,ic%,b%)")
fkey_status(ic%)
Modify%
keynumber%
ic%>=0
ic%<23
kpad%=ic%
ic%=22
$Kpadicon%="Soptoff;r5,14"
$Kpadicon%=$
val(keypadW%,ic%)
$FkeyTitle%=vname$(ic%+9)
$ keynumber%=buttonfield%(1,ic%)
keynumber%>0
- $Fkeyequiv%="F"+
(keynumber%
%1111)
/
set_icon(fkeyW%,1,(keynumber%
1<<4))
/
set_icon(fkeyW%,2,(keynumber%
1<<5))
$
text(fkeyW%,3)="None"
deselect(fkeyW%,1)
deselect(fkeyW%,2)
lit(keystrokeM%,0,
lit(keystrokeM%,0,
show_menu(keystrokeM%,x%-64,y%)
load_functionkeys
F,I%,d$
buttonfield%()=0
(-1)
d$="Initial"
d$="Resources"
("<Pbase$Dir>."+d$+".Fkeys")
buttonfield%(1,I%)=
I%+=1
close_file(F)
save_fkeys
F,I%
("<Pbase$Dir>.Resources.Fkeys")
I%=0
(buttonfield%(1,I%))
close_file(F)
list_fkeys
I%,K%,pad%,F,K$,S$
print_init("W")
@TextName$=$database%+".PrintJobs.Fkeys":$SaveName%=TextName$
format$="keys"
spacer$,"|")>0
spacer$="|"
,LenLine%=Lmargin%+39:Tab%(2)=Lmargin%+30
8maxhead%=0:fspace%=18:hspace%=3*36-18:PrintFields%=2
send_title("Keystroke equivalents")
"Hourglass_On"
I%=0
K%=buttonfield%(1,I%)
K%=0
K$="None"
K$="F"+
%1111)
pad%=2
.
(K%
(1<<4))
(139)+K$:pad%-=1
+
(K%
(1<<5))
K$="^"+K$:pad%-=1
store_string(vname$(I%+9),Lmargin%,
store_string(K$,Tab%(2)+pad%,
,
13:S$=vname$(I%+9)+" all subfiles"
'
14:S$="Copy displayed record"
(
18:S$="Turn validation ON/OFF"
:S$=""
S$<>""
$
store_string(S$,Lmargin%,
,
store_string(
(139)+K$,Tab%(2)+1,
("<Pbase$Dir>.Resources.KeyList")
store_string(
#F,Lmargin%,
close_file(F)
"Hourglass_Off"
screen_list
write_log(-1,"Keystroke equivalents printed","")
scan(z%,s%)
stop%=
addr=
moveto(key%,addr,z%)
K%=
complete(4)
stop%
store
wi%,ic%
printorder$<>""
(-1)
to_clipboard
"Wimp_GetCaretPosition",,block%
wi%=!block%:ic%=block%!4
! scratchpad$=$
text(wi%,ic%)
to_clipboard
I%,L%,P%,len%,S$,b$
NSHsaveptr%=
extend_named_sliding_block(saveanchor%,SHclaim%):P%=SHsaveptr%
clear_mem(SHsaveptr%,0,
sliding_block_size(saveanchor%))
I%=1
printorder$
( F$=
printorder$,I%,2):F%=
("&"+F$)
chartype%(F%)
k
0,1,2,3,4,5,6,7,8,46,47,48,49,50,51,52,53,54,55,56,57,58,63,68,69,70,71,72,73,74,75,76,77,78,79:
S$=$Rf%(F%):L%+=
(S$)+1
0 SHsaveptr%=
claim_page(saveanchor%,L%+1)
$P%=S$:P%+=
(S$)+1
36,39:
3 len%=
blob_path(
,$database%,REC%,F%,39,b$)
len%>0
L%+=len%
2 SHsaveptr%=
claim_page(saveanchor%,L%+1)
"OS_File",255,b$,P%
P%+=len%+1
41,42,43,61,62:
% S$=$Rf%(F%):Z%=
no_yes(F%,S$)
L%+=
(S$)+1
0 SHsaveptr%=
claim_page(saveanchor%,L%+1)
$P%=S$:P%+=
(S$)+1
@Start%=SHsaveptr%:End%=Start%+L%:datasize%=L%:ramptr%=Start%
clip%
- block%!0=24:block%!16=15:block%!20=%100
"Wimp_SendMessage",17,block%,0
# clip%=
:savefunc$="Clipboard"
retrieve(S$)
(-1)
request_clipped
wi%,ic%,L%
"Wimp_GetCaretPosition",,block%
wi%=!block%:ic%=block%!4
scratchpad$<>""
!" L%=
buffer_length(wi%,ic%)
$
text(wi%,ic%)=
S$,L%)
#C
F$(Fieldnumber%)<>""
text(wi%,ic%)=F$(Fieldnumber%)
redraw_icon(wi%,ic%)
set_caret(0,wi%,ic%)
vtype$(chartype%(Fieldnumber%))="L"
ScrollChanged%=
request_clipped
,(!block%=256:block%!12=0:block%!16=16
- block%!20=mainW%:block%!24=1
.Fblock%!28=0:block%!32=0:block%!36=%100:block%!40=&fff:block%!44=-1
"Wimp_SendMessage",18,block%,0:
Broadcast DataRequest
my_ref%=block%!8:pasting%=
from_clipboard(f$)
wi%,ic%,F%,L%,S$
"Wimp_GetCaretPosition",,block%
wi%=block%!0:ic%=block%!4
S$=
wi%
;#
mainW%:F%=
get_field(ic%)
chartype%(F%)
0,1,2,3,4,5,8,63:
>= $
text(wi%,ic%)=
S$,len%(F%)):
redraw_icon(wi%,ic%)
?
F%+=1:ic%=field%(F%)
A
tableW%(Tablenumber%):
B" L%=
buffer_length(wi%,ic%)
C5 $
text(wi%,ic%)=
S$,L%):
redraw_icon(wi%,ic%)
ic%+=1
close_file(F)
H-block%!0=20:block%!12=my_ref%:block%!16=4
"Wimp_SendMessage",17,block%
pasting%=
### Binary Large Objects (B.L.O.B.s) ###
blob_path(create%,f$,R%,F%,V%,
O$,main$,level1$,level2$,d%,dn%,do%,L%,bn$,bo$
R%<0
softerror("",164):=-1
36,39:main$=f$+"."+Tag$(F%)+"text"
37,40:main$=f$+"."+Tag$(F%)+"sprite"
38:main$=f$+"."+Tag$(F%)+"draw"
64,65,66,67:main$=f$+"."+Tag$(F%)+"scroll"
X"level1$=main$+"."+
4900)
Y"level2$=level1$+"."+
ZTbn$=level2$+".Rec"+
(R%):
"OS_File",5,bn$
dn%,,,,Ln%:
dn%=1
d%=dn%:L%=Ln%
[Vbo$=level2$+"."+
70):
"OS_File",5,bo$
do%,,,,Lo%:
do%=1
d%=do%:L%=Lo%
objname$
"NEW":b$=bn$:
do%=1
dn%=0
"OS_CLI","Rename "+bo$+" "+bn$
"OLD":b$=bo$:
dn%=1
do%=0
"OS_CLI","Rename "+bn$+" "+bo$
d%=0
create%=
"OS_File",8,main$
"OS_File",8,level1$
"OS_File",8,level2$
d%=1
load_blob(f$,R%,F%,V%)
L%,b$
i#L%=
blob_path(
,f$,R%,F%,V%,b$)
L%>=0
k; SHmisc%=
extend_named_sliding_block(tempanchor%,L%+1)
"OS_File",255,b$,SHmisc%
blob_to_file(F,L%)
Used only to transfer CSV fields to external files
L%>0
"OS_GBPB",2,F,SHmisc%,L%
copy_blob(source$,dest$,RS%,RD%,F%,V%)
L%,Z%,bs$,bd$
w*L%=
blob_path(
,source$,RS%,F%,V%,bs$)
L%>0
y* Z%=
blob_path(
,dest$,RD%,F%,V%,bd$)
"OS_CLI","Copy "+bs$+" "+bd$+" ~C~V~Q"
delete_blob(F%,F$,wi%,ic%)
flag%,f$,object$
selected(prefsW%,20)
confirm(
msg("Err115,"+$RemoveOb%))
(
"OS_CLI","Delete "+F$:flag%=
"OS_CLI","Delete "+F$:flag%=
flag%
chartype%(F%)
6
36:$
val(wi%,ic%)="R5;Pptr_ext,8,4;Ssm!edit"
7
37:$
val(wi%,ic%)="R5;Pptr_ext,8,4;Ssm!paint"
6
38:$
val(wi%,ic%)="R5;Pptr_ext,8,4;Ssm!draw"
39:$
text(wi%,ic%)=""
#
show_picture(F%,REC%)
64,65,66,67:
/
get_scroller(REC%,F%,chartype%(F%)-63)
redraw_icon(wi%,ic%)
asterisk(
set_blob_sprite(R%,F%,V%,
L%,sprite$
R%=RA%
L%=-1
blob_path(
,$database%,R%,F%,V%,b$)
L%>=0
sprite$="small_fff"
sprite$="sm!edit"
L%>=0
sprite$="small_ff9"
sprite$="sm!paint"
L%>=0
sprite$="small_aff"
sprite$="sm!draw"
val(mainW%,field%(F%))="R5;Pptr_ext,8,4;S"+sprite$
redraw_icon(mainW%,field%(F%))
edit_blob(F%,V%)
wi%,ic%,b$,O$,val$,F
"Wimp_GetCaretPosition",,block%:returnto%=block%!4
wi%=mainW%:ic%=field%(F%)
36:O$="Text":val$="R5;Pptr_ext,8,4;Ssmall_fff":ftype%=&fff:OLE%=F%
37:O$="Sprite":val$="R5;Pptr_ext,8,4;Ssmall_ff9":ftype%=&ff9:OLE%=F%
38:O$="Draw":val$="R5;Pptr_ext,8,4;Ssmall_aff":ftype%=&aff:OLE%=F%
39:O$="Text":val$="L;Pptr_ext,8,4":ftype%=&fff:OLE%=F%
40:O$="Sprite":val$="Z0;Pptr_ext,8,4;Ssmall_ff9":ftype%=&ff9:OLE%=F%
blob_path(
,$database%,REC%,F%,V%,b$)<0
V%<>40
val(wi%,ic%)=val$
"OS_CLI","Copy <PBase$Dir>.Resources.Objects."+O$+" "+b$+" ~C~V"
V%=36
(b$):
#F,"Record "+
(REC%)+": "+$Rf%(KF%(0,0)):
close_file(F)
redraw_icon(wi%,ic%)
OLE%>0
OLE$=b$:
"OS_File",5,b$
,,,OLEDS%
"OS_CLI","Filer_Run "+b$
transfer_blob(wi%,ic%,file$,d%,ft%)
F%,V%,L%,W%,f$,b$,ok%,list$,c$,name%
wi%<>mainW%
Access%=
#F%=(ic%+1)
2:V%=chartype%(F%)
"name%=
text(mainW%,field%(F%))
60:f$=
compare_paths(file$,$database%)
(f$)<=len%(F%)
$Rf%(F%)=f$
- Z%=
set_remote_sprite(F%,file$):ok%=
/
softerror(file$+","+
(len%(F%)),154)
ft%=-1
. file$=
compare_paths(file$,$database%)
- link$(F%)="@"+file$:link$(0)="LOADED"
& $
val(wi%,ic%)="R5;Sdirectory"
5
WithLeaf%
$name%=
leaf(file$)
$name%=""
ok%=
ft%<>-1
. file$=
compare_paths(file$,$database%)
- link$(F%)="@"+file$:link$(0)="LOADED"
* $
val(wi%,ic%)="R5;Sfile_"+
~(ft%)
5
WithLeaf%
$name%=
leaf(file$)
$name%=""
ok%=
ft%=&fff
install_blob:$
val(wi%,ic%)="R5;Pptr_ext,8,4;Ssmall_fff":ok%=
ft%=&ff9
install_blob:$
val(wi%,ic%)="R5;Pptr_ext,8,4;Ssmall_ff9":ok%=
ft%=&aff
install_blob:$
val(wi%,ic%)="R5;Pptr_ext,8,4;Ssmall_aff":ok%=
ft%=&fff
install_blob:
show_text_block(F%,REC%):ok%=
ft%=&ff9
install_blob:
show_picture(F%,REC%):ok%=
ok%
redraw_icon(wi%,ic%):
asterisk(
install_blob
blob_path(
,$database%,REC%,F%,V%,b$)
"OS_CLI","Remove "+b$
"OS_CLI","Copy "+file$+" "+b$+" ~C~V"
show_text_block(F%,REC%)
F,b$,I%,len%,base%
F%=0
base%=Rf%(F%)
/len%=
blob_path(
,$database%,REC%,F%,39,b$)
len%>0
len%>len%(F%)
len%=len%(F%)
### Load only as much of file as we can display ###
@ F=
(b$):
F>0
"OS_GBPB",4,F,base%,len%:
close_file(F)
### Replace any characters<32 by spaces - but ONLY for display ###
I%=0
len%-1
#
base%?I%<32
base%?I%=32
base%?len%=10
$base%=""
show_picture(F%,REC%)
F,f$,I%,max%,len%,x%,y%,w%,h%,base%
F%=0
/len%=
blob_path(
,$database%,REC%,F%,40,f$)
E!block%=mainW%:block%!4=field%(F%):
"Wimp_GetIconState",,block%
<x%=block%!8:y%=block%!12:w%=block%!16-x%:h%=block%!20-y%
"Wimp_DeleteIcon",,block%
len%>=0
7 base%=
extend_named_sliding_block(Rf%(F%),len%+4)
/ !base%=len%+4:
"OS_File",255,f$,base%+4
Q field%(F%)=
create_icon(0,mainW%,x%,y%,w%,h%,&0700A53E,"",base%+16,base%,0)
base% points to sprite area, base%+16 to sprite itself
K field%(F%)=
create_icon(0,mainW%,x%,y%,w%,h%,&0700A53E,"",paint%,1,8)
paint% points to sprite name (File_ff9),1 means wimp pool,8 is name length
get_remote_file(field%)
f$,err%
filename($Rf%(field%),"PrintRes",-1)
f$<>""
"XOS_File",5,f$
d%;err%
(err%
1)=1
5
softerror(f$+","+
leaf(f$)+","+Tag$(F%),121)
.
d%>0
"OS_CLI","Filer_Run "+f$
set_remote_sprite(field%,f$)
d%,type%,err%,wi%,ic%,sprite$
!wi%=mainW%:ic%=field%(field%)
f$=""
d%=-1
"XOS_File",5,f$
d%,,type%;err%
(err%
1)=1
softerror(f$+","+
leaf(f$)+","+Tag$(field%),121):d%=0
0:sprite$="whatsit":
Filename present but file not found
-1:sprite$="dropfile":
No filename in field
1:type%=(type%>>8)
&fff:sprite$="file_"+
~(type%)
c$=
leaf(f$),1)
c$="!"
sprite$="application"
sprite$="directory"
val(wi%,ic%)="R5;Pptr_ext,8,4;S"+sprite$
redraw_icon(wi%,ic%)
filter(wi%,b%,on%)
x%,y%,vxmin%,vymax%,scrollx%,scrolly%
b%=1
on%=
on%=
b%=4
filter%=on%:finished%=
->matched%=0:$
text(filterW%,5)="0":
redraw_icon(filterW%,5)
on%
wi%
keypadW%:
24 !block%=wi%:
"Wimp_GetWindowState",,block%
3=
position_window(filterW%,block%!12,block%!8,0,0,0,0)
4A
mainW%:
open_at(firstfilter%,filterW%,22,482,316,44,44)
b%=1
$Query%=query$
set_caret(0,queryW%,0)
9B Filter$="TRUE":
close_it(filterW%):
restore_caret(returnto%)
set_icon(keypadW%,22,on%)
field%(buttonfield%(0,22))>0
set_icon(mainW%,field%(buttonfield%(0,22)),on%)
fast_wind(T%,P%,D%)
A fast%=
text(keypadW%,23))
D%=(D%+1)
P%<>T%
I%<fast%
filter%
next_match(P%,D%,Filter$,Z%)
neighbour(key%,P%,D%)
I%+=1
P%=T%
filter%
7:P%=
neighbour(key%,P%,1-D%)
merging%
merge_next(filter%,key%,P%)
display(key%,P%)
subfile(direction%)
file%+=direction%
file%=6
file%=0
file%=-1
file%=5
set_subfile(file%)
filemem%(file%,key%)>=0
Q3 addr=filemem%(file%,key%):
display(key%,addr)
addr=
moveto(key%,top,1)
set_subfile(fi%)
top=8*fi%+LH%
Y $Subfilename%=$Subfile%(fi%)
ic%=6
deselect(queryW%,ic%)
select(queryW%,fi%+6)
save_subfilenames
present%=7
c! F=
($database%+".Subfiles")
I%=0
#F,$Subfile%(I%)
close_file(F)
allow_search(wi%,e%)
select(searchW%,5):
deselect(searchW%,6)
select(searchW%,6):
deselect(searchW%,5)
text(searchW%,1)="":
redraw_icon(searchW%,1)
text(searchW%,7)="":
redraw_icon(searchW%,7)
text(searchW%,3)=Index$(key%)
wi%
keypadW%:
u7 !block%=keypadW%:
"Wimp_GetWindowState",,block%
position_window(searchW%,block%!12,block%!8,0,0,0,0)
mainW%:
open_at(firstsearch%,searchW%,13,456,316,114,52)
set_caret(0,searchW%,1)
val_help
name$,subst%,field%,extra%,fld%,scrcol%
"Wimp_GetCaretPosition",,block%
wi%=block%!0:ic%=block%!4
scroller_num2(wi%)
wi%
mainW%:fld%=(ic%+1)
scrollerW%(S%):fld%=scrolldata%(S%,0)
fld%>0
name$=link$(fld%)
+ field%=
trailing_number(name$,exact%)
+ subst%=
leading_number(scrcol%,name$)
' Tablenumber%=
table_number(name$)
Tablenumber%<>-1
show_table(Tablenumber%,0,0)
Tablenumber%=0
val_on_off(on%)
I%=1
on%
$
:$valid%(I%)=$rvalid%(I%)
(
:$valid%(I%)="Pptr_write,4,4"
save_click(wi%,ic%,b%)
f$,p$,H$
butt%=(b%
%111)
ic%=4
text(wi%,ic%)
"Default selection":
y
selected(wi%,ic%)
$SaveName%=$database%+".PrintRes.!Selection"
$SaveName%=$database%+".PrintRes.Selection"
"Default query":
q
selected(wi%,ic%)
$SaveName%=$database%+".PrintRes.!Query"
$SaveName%=$database%+".PrintRes.Query"
"Default options":
y
selected(wi%,ic%)
$SaveName%=$database%+".PrintRes.!PrintOpts"
$SaveName%=$database%+".PrintRes.PrintOpts"
redraw_icon(wi%,2)
wi%
saveW%:
Filename$=$SaveName%
savefunc$
#
"New database","Copy as":
+ $SaveName%=
force_pling($SaveName%)
$ Filename$=$SaveName%:Type%=0
2
"Save as text":
Save report from window
4
vrules%>0
vrules%=0:
add_spacers(Count%)
Type%=&fff
5 Start%=SHtextptr%:End%=Start%+Count%*LenLine%
-
"Save list":
Create report to file
Type%=&fff:savetofile%=
;
"Save text":
Save Text from button or Text Block
Type%=&fff:
= len%=
blob_path(
,$database%,REC%,Fieldnumber%,36,f$)
B SHsaveptr%=
extend_named_sliding_block(saveanchor%,len%+1)
&
"OS_File",255,f$,SHsaveptr%
* Start%=SHsaveptr%:End%=Start%+len%
<
"Save sprite":
Save from Sprite button or Picture
Type%=&ff9
= len%=
blob_path(
,$database%,REC%,Fieldnumber%,37,f$)
B SHsaveptr%=
extend_named_sliding_block(saveanchor%,len%+1)
&
"OS_File",255,f$,SHsaveptr%
* Start%=SHsaveptr%:End%=Start%+len%
-
"Save draw":
Save from Draw button
Type%=&aff
= len%=
blob_path(
,$database%,REC%,Fieldnumber%,38,f$)
B SHsaveptr%=
extend_named_sliding_block(saveanchor%,len%+1)
&
"OS_File",255,f$,SHsaveptr%
* Start%=SHsaveptr%:End%=Start%+len%
1
"Save object":
Save from Remote button
5
"Save as list":
Save Scroller as text list
Type%=&fff:
= len%=
blob_path(
,$database%,REC%,Fieldnumber%,64,f$)
B SHsaveptr%=
extend_named_sliding_block(saveanchor%,len%+1)
* Start%=SHsaveptr%:End%=Start%+len%
&
"OS_File",255,f$,SHsaveptr%
* Start%=SHsaveptr%:End%=Start%+len%
#
"Save options":Type%=&7f5
"Save query":
=
$Query%=""
$savebuff%=query$
$savebuff%=$Query%
B Start%=savebuff%:End%=Start%+
($savebuff%)+1:Type%=&7f4
*
"Save selection":
save_selection
"Save table":
c z$=
table_info(Tablenumber%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)
P Start%=SHtabptr%(Tablenumber%):End%=Start%+offset%+Rows%*Rec%:Type%=&7f1
"Save form file":
Type%=&7f2
lit(designM%,4,
lit(designM%,5,
lit(designM%,7,
6
adjust%=
first_writable>0
default_key
9
"Export selected":
export_selected(printorder$)
savesubW%:
savefunc$
"Export subset":
) $SubName%=
force_pling($SubName%)
D
$SubName%=$database%
ic%<>3
moan_err%,
msg("Err222")
# Filename$=$SubName%:Type%=0
*
"Export CSV":Filename$=$SubName%
ic%
(b%
%11110000)>0
init_drag(wi%,ic%,5)
Filename$,".")>0
7
butt%<>2
save(Filename$,Type%,Start%,End%)
.
write_log(-1,"File saved:",Filename$)
butt%=4
wi%=saveW%
$
"Wimp_CreateMenu",,-1
7
close_it(wi%):
restore_caret(starthere%)
softerror("",33)
"Wimp_CreateMenu",,-1
close_it(wi%):
restore_caret(returnto%)
force_pling(f$)
leaf$=
leaf(f$)
leaf$,1)<>"!"
leaf$="!"+leaf$
leaf$=
leaf$,NameLength%)
leaf$="!"
leaf$="!XYZZY"
leafnamepath$=""
=leaf$
=leafnamepath$+"."+leaf$
key_click(wi%,ic%,b%)
I%,J%,L%,tag$,item$
butt%=(b%
%111)
z%=(butt%=1)-(butt%=4)
butt%
2,4:
ic%
8,9,10,11:
3 tag$=$
text(wi%,ic%+4+3*(ic%-8)):L%=
(tag$)
& fieldsM%=
field_menu(items%,3)
( item$=$
menu_text(fieldsM%,I%)
I%+=1
%
item$,L%)=tag$
I%>items%
6
tag$<>""
tick_one(fieldsM%,0,items%,I%-1)
A
show_pop_up_menu(fieldsM%,wi%,ic%):fieldfunc$=
(ic%-8)
butt%
1,4:
ic%
6
0,1,2,3:
kcycle(keyfield%(ic%),4*ic%+12,-z%)
6
4,5,6,7:
kcycle(keyfield%(ic%-4),4*ic%-4,z%)
#
keyfunc$<>"Current key"
keylimit%=0:keylen%=0
J%=0
* keylimit%+=len%(keyfield%(J%))
+ keylen%+=
text(wi%,4*J%+15))
!1
keylen%>keylimit%:
softerror("",26)
"*
keylen%=0:
softerror("",105)
keyfunc$
"Primary key":
&,
save_form($database%+".Form")
key%=0
(!
copy_keydata(key%)
), RA%=
($Records%):f$=$database%
*(
make_empty_index(RA%,0,
+,
save_recs(f$+".Database",RA%)
,/ present%=7:
save_keys:
save_calcs
-< design%=
:present%=1:
get_it_in(f$):ramwarn%=
.2
"New primary key":
new_tree(file%)
/4
"Create index":
create_index(key%,
2
keyfunc$=""
4B
butt%=4
close_window(keyW%):
restore_caret(returnto%)
5;
close_window(keyW%):
restore_caret(returnto%)
shade_key_icons(con%)
shade(keyW%,30,con%)
I%=0
shade(keyW%,I%,con%)
shade(keyW%,31,con%)
shade(keyW%,12,
shade(keyW%,16,
shade(keyW%,20,
shade(keyW%,24,
shade(keyW%,30,con%)
shade(keyW%,35,con%)
shade(keyW%,37,con%)
kcycle(
F%,show%,z%)
J%=0
text(keyW%,show%+J%)=""
N,F%=
find_next_valid_field(F%,"index",z%)
F%>0
P" $
text(keyW%,show%)=Tag$(F%)
Q; $
text(keyW%,show%+1)="1":
set_caret(0,keyW%,show%+1)
text(keyW%,show%+2)="L"
S' $
text(keyW%,show%+3)=
(len%(F%))
J%=0
redraw_icon(keyW%,show%+J%)
find_next_valid_field(F%,use$,z%)
F1%,found%
F%+=z%
F%>fields%
F%=0
F%<0
F%=fields%
V%=chartype%(F%)
F%>0
use$
"index":
vtype$(V%)
e,
"S":found%=(V%<>59):
Not Logo
f9
"C":found%=(V%=6
V%=7):
Calc & Comp only
g9
"X":found%=(V%=60):
Remote only (pathname)
h9
"E":found%=(len%(F%)>0):
Not simple labels
"help":
vtype$(V%)
l,
"S":found%=(V%<>59):
Not Logo
m"
"C","T","L":found%=
nL
"X":found%=(V%=36
V%=39
V%=60):
Text, Text block & Remote
o9
"E":found%=(len%(F%)>0):
Not simple labels
q
found%=
found%
copy_keydata(key%)
J%,chars%,pos%,word%,field%
KL%(key%)=0
J%=0
{7 chars%=
text(keyW%,4*J%+15)):KL%(key%)+=chars%
text(keyW%,4*J%+14)
"L":pos%=0
"R":pos%=255
'
:pos%=
text(keyW%,4*J%+14))
$ word%=
text(keyW%,4*J%+13))
field%=keyfield%(J%)
< KW%(key%,J%)=chars%+(pos%<<8)+(word%<<16)+(field%<<24)
KF%(key%,J%)=field%
#case%(key%)=
selected(keyW%,30)
set_keydata(key%)
J%,chars%,pos%,word%,field%,W%
J%=12
text(keyW%,J%)=""
J%=0
W%=KW%(key%,J%)
W%>0
7 chars%=W%
255:$
text(keyW%,4*J%+15)=
(chars%)
pos%=(W%>>8)
pos%
'
text(keyW%,4*J%+14)="L"
)
255:$
text(keyW%,4*J%+14)="R"
)
text(keyW%,4*J%+14)=
(pos%)
; word%=(W%>>16)
255:$
text(keyW%,4*J%+13)=
(word%)
> field%=KF%(key%,J%):$
text(keyW%,4*J%+12)=Tag$(field%)
keyfield%(J%)=field%
text(keyW%,29)=
(key%)
set_icon(keyW%,30,case%(key%))
set_icon(keyW%,35,incspace%(key%))
set_icon(keyW%,37,null%(key%))
key_select(D%)
"Wimp_GetCaretPosition",,block%
wi%=block%!0:ic%=block%!4
colour(key%,2)
! key%=(key%+1)
(Keys%+1)
Index$(key%)<>""
hide%?KF%(key%,0)<>1
% key%-=1:
key%<0
key%=Keys%
Index$(key%)<>""
hide%?KF%(key%,0)<>1
colour(key%,1)
set_keydata(key%)
text(searchW%,3)=Index$(key%):
redraw_icon(searchW%,3)
top=8*file%+LH%
filemem%(file%,key%)>=0
3 addr=filemem%(file%,key%):
display(key%,addr)
addr=
moveto(key%,top,1)
restore_caret(starthere%)
set_key(index$)
k%,I$
k%=-1
index$=""
index$="PRIMARYKEY"
k%+=1
I$=
u(Index$(k%))
I$=index$
I$="TEMPORARY"
I$=index$
colour(key%,2)
key%=k%
colour(key%,1)
set_keydata(key%)
addr=
moveto(key%,top,1)
softerror(index$,199)
set_colours(wi%,ic%,b%)
I%,col%,C%,V%,J%,d$
(b%
%111)=4
z%=1
z%=-1
(b%
%111)
1,4:
ic%
!
0,1,2,3,4,5,6,7,8,9,10:
@ col%=
get_icon_cols(wi%,ic%):fg%=col%
16:bg%=col%
I
selected(wi%,18)
fg%=(fg%+z%+16)
bg%=(bg%+z%+16)
' col%=fg%+bg%*16:fcol%(ic%)=col%
$
set_icon_cols(wi%,ic%,col%)
I%=0
Keys%
colour(I%,2)
colour(key%,1)
I%=1
fields%
F
link$(I%)<>""
set_icon_cols(mainW%,field%(I%),fcol%(8))
H
mandatory%?I%=1
set_icon_cols(mainW%,field%(I%),fcol%(9))
V%=chartype%(I%)
vtype$(V%)="L"
C%=V%-63
J%=1
/
colour_scroller(I%,J%,fcol%(10))
/
(-1)
d$="Initial"
d$="Resources"
5
read_colours("<Pbase$Dir>."+d$+".FieldCols")
close_window(wi%)
!
selected_esg(wi%,1)
3
13:f$="<Pbase$Dir>.Resources.FieldCols"
)
14:f$=$database%+".FieldCols"
write_colours(f$)
create_click(wi%,ic%,b%,caret%)
width%,oldmenu%,oldmenu$,ok%
caret%=26
shade(wi%,29,
shade(wi%,30,
butt%=(b%
%111)
butt%
2,4:
ic%=36
show_pop_up_menu(ftypeM%(menunumber%),wi%,ic%)
ic%=44
fieldsM%=
field_menu(items%,0):
tick_one(fieldsM%,0,fields%-1,Fieldnumber%-1):
show_pop_up_menu(fieldsM%,wi%,ic%)
butt%=4
z%=1
butt%=1
z%=-1
ic%
set_limits(0)
set_limits(1)
set_limits(2)
set_limits(3)
set_limits(4)
set_limits(5)
set_limits(6)
set_limits(7)
change_type(-z%,menunumber%)
change_type(z%,menunumber%)
create_field(
($InsText%),posx%,posy%,0,ok%)
chartype%(Fieldnumber%)=33
oldmenu%=
(Tag$(Fieldnumber%)):oldmenu$=$database%+".Menus."+Tag$(oldmenu%)+"Menu"
create_field(Fieldnumber%,posx%,posy%,Fieldnumber%,ok%)
remove_field(Fieldnumber%,
14,45,46:
shade(wi%,13,(
selected(wi%,14)))
F%=
($InsText%)
F%>0
F%<=fields%
(
F%<Fieldnumber%
Z%=-1
Z%=1
(
re_sequence(Fieldnumber%,F%,Z%)
close_window(wi%)
D x%=
($boxX%):y%=
($boxY%):int%=
($Gridsnap%):
snap(x%,y%,int%)
swap_fields(Fieldnumber%,
($InsText%))
close_it(wi%)
42:$boxW%=
guess_width(
($LenText%),fieldtype%,width%)):
redraw_icon(wi%,9)
snap_all
50,51,52,53:
nudge(butt%,ic%)
update_box
(present%
4)=0
lit(designM%,2,(fields%>0))
ic%
18,29:
ok%
butt%=4
close_window(wi%)
30,39,40:
butt%=4
close_window(wi%)
21,47,24,22,23,48,35,54:
ic%=54
sformat(wi%,
sformat(wi%,
sformat(wi%,full%)
ic%=56
shade(wi%,ic%,
-0!block%=wi%:
"Wimp_GetWindowState",,block%
full%
:block%!8=block%!16-730:
"Wimp_OpenWindow",,block%
shade(wi%,56,
shade(wi%,57,
:block%!8=block%!16-640:
"Wimp_OpenWindow",,block%
update_box
shade(createW%,6,
shade(createW%,63,
fieldtype%
0,1,2,3,4,5,6,7,46,47,63:
adjust%
shade(createW%,6,
36,37,38,60:
shade(createW%,63,
$TagText%=""
$TagText%=Tag$(fields%):
redraw_icon(createW%,5)
=&num%=(fieldtype%=3
fieldtype%=6)
shade(createW%,14,num%)
shade(createW%,45,num%)
shade(createW%,46,num%)
shade(createW%,13,num%
selected(createW%,14))
shade(createW%,15,(fieldtype%=3
fieldtype%=47))
shade(createW%,25,(fieldtype%=3))
shade(createW%,26,
adjust%)
$Reformatted%=""
adjust%
lit(designM%,3,(fields%>0))
F $ValText%=vname$(fieldtype%)
redraw_icon(createW%,28)
set_scroll_def(F%,cols%,load%,clear%,height%)
ic%,col%,P%,F,f$
shade(createW%,56,cols%>0)
col%=1
shade(createW%,col%+56,col%<=cols%)
col%
load%:
R0 f$=$database%+"."+Tag$(F%)+"scroll.Format"
col%=1
cols%
U" P%=
text(createW%,col%+56)
V!
F>0
$P%=
$P%="?"
W&
redraw_icon(createW%,col%+56)
col%
close_file(F)
Z) $
text(createW%,56)=
(height%
clear%:
ic%=56
]: $
text(createW%,ic%)="":
redraw_icon(createW%,ic%)
set_limits(m%)
lit%
currenttype%=0
lasttype%=?flist%(m%)
menunumber%=m%
lit(ftypeM%(m%),currenttype%)
currenttype%+=1
tick_one(ftypeM%(m%),0,lasttype%-1,currenttype%)
k+fieldtype%=?(flist%(m%)+currenttype%+1)
update_box
change_type(d%,m%)
currenttype%+=d%
s5
currenttype%=lasttype%
currenttype%=0
t8
currenttype%<0
currenttype%=lasttype%-1
lit(ftypeM%(m%),currenttype%)
tick_one(ftypeM%(m%),0,lasttype%-1,currenttype%)
x+fieldtype%=?(flist%(m%)+currenttype%+1)
update_box
passwords(x%,wi%,ic%,b%)
ic%=19
(b%
%11110000)>0
Filename$="Log":Type%=&fff
init_drag(wi%,ic%,5)
b%=(b%
%111)
1,4:
ic%
%
$Write%=""
$Write%=$Read%
*
$Manager%=""
$Manager%=$Write%
F=
($database%+".Data")
$ S$=
encrypt($Read%,
#F,S$
% S$=
encrypt($Write%,
#F,S$
' S$=
encrypt($Manager%,
#F,S$
I%=9
"
selected(passW%,I%)
close_file(F)
& ShowTools%=
selected(passW%,9)
.
lit(mainM%,6,ShowTools%
(Tools%=1))
?
printorder$<>""
lit(mainM%,7,
selected(passW%,13))
+
lit(mainM%,8,
selected(passW%,13))
+
lit(mainM%,9,
selected(passW%,13))
,
lit(mainM%,10,
selected(passW%,13))
+
lit(mainM%,2,
selected(passW%,14))
close_window(aclW%)
K
b%=4
close_window(passW%):
x%>=0
restore_caret(starthere%)
ShowTools%
!
close_window(keypadW%)
x%>=0
Tools%
;
position_window(keypadW%,100,50,0,0,0,0)
&
open_window(mainW%)
asterisk(
selected(passW%,16)
&
open_log("<Log$Dir>.Log",
'
close_log("<Log$Dir>.Log")
4
shade(prefsW%,34,
selected(passW%,15))
P
selected(passW%,16)
write_log(-1,"Logging discontinued","")
A $
text(aclW%,0)="":$
text(aclW%,1)="":$
text(aclW%,12)=""
@
deselect(aclW%,
selected_esg(aclW%,1)):
select(aclW%,4)
1
open_window(aclW%):
set_caret(0,aclW%,0)
4
restore_window(wi%,remember%+winbuff%(1,1))
close_window(aclW%)
M
b%=4
close_window(wi%):
restore_caret(starthere%)
redraw(wi%)
+
"OS_File",5,"<Log$Dir>.Log"
O
d%=1
"OS_CLI","Filer_Run <Log$Dir>.Log"
softerror("",195)
F,user$,passwd$,ok%
ic%=15
(b%
%11110000)>0:
8 Filename$="Acl":Type%=&ffd:
init_drag(wi%,ic%,5)
(b%
%111)=1:
B
"OS_ReadVarVal","Acl$Dir",block%,255
,,L%:block%?L%=13
softerror($block%,210)
b%=(b%
%111)
ic%
!
close_window(aclW%)
#
selected_esg(aclW%,1)
user$=$
text(aclW%,0)
I
confirm(
msg("Err123,"+user$))
remove_user(user$,
):ok%=
user$=$
text(aclW%,0)
remove_user(user$,
3
text(aclW%,0)="":
softerror("",126)
B
text(aclW%,1)<>$
text(aclW%,12):
softerror("",108)
3
text(aclW%,1)="":
softerror("",125)
- user$=
encrypt($
text(aclW%,0),
/ passwd$=
encrypt($
text(aclW%,1),
acl%
" F=
("<Acl$Dir>.Acl")
$
("<Acl$Dir>.Acl")
acl%=
6
#F,user$,passwd$,
selected_esg(aclW%,1)-3
close_file(F)
ok%=
A $
text(aclW%,0)="":$
text(aclW%,1)="":$
text(aclW%,12)=""
K
redraw_icon(aclW%,0):
redraw_icon(aclW%,1)::
redraw_icon(aclW%,12)
set_caret(0,aclW%,0)
6
(b%
%111)=4
ok%=
close_window(aclW%)
remove_user(u$,remove%)
user$,id$,p%,p%,ptr%,F,found%
u$<>""
user$=
encrypt(u$,
acl%
F=
("<Acl$Dir>.Acl")
ptr%=
#F,id$,p$,p%
found%=(id$=user$)
found%
found%
1
#F=ptr%:
(id$),"Z"),
(p$),"Z"),0
*
remove%
softerror(u$,124)
close_file(F)
open_log(f$,resume%)
"OS_File",5,f$
d%=1
loghandle%=
#loghandle%=
#loghandle%
resume%
#loghandle%,"Logging resumed "+
#loghandle%,"Log opened "+
#loghandle%,"Database: "+$database%
. loghandle%=
(f$):
"OS_File",18,f$,&fff
#loghandle%,"Log started "+
#loghandle%,"Database: "+$database%
acl%
#loghandle%,"User: "+user$
#loghandle%,"Password level used: "+
(pw%)
#loghandle%,
35,"-")
close_file(loghandle%)
logging%=
close_log(f$)
logging%
loghandle%=
#loghandle%=
#loghandle%
#loghandle%,
35,"-")
#loghandle%,"Log closed "+
#loghandle%,
35,"=")
close_file(loghandle%)
logging%=
write_log(record%,S$,T$)
loghandle%
logging%
"# loghandle%=
("<Log$Dir>.Log")
#loghandle%=
#loghandle%
record%>=0
#loghandle%," [Record number: "+
(record%)+"]"
#loghandle%," "+S$
T$<>""
#loghandle%," "+T$
close_file(loghandle%)
count(key%,
RU%)
zero%,file%,top,sum%
- RU%=0
file%=0
top=8*file%+LH%
0" sum%=
count_recs(key%,zero%)
RU%+=sum%
2% $
text(miscW%,file%+22)=
(sum%)
file%
count_recs(key%,
ptr%)
P%,count%,S%,R%,S$,k$
"Hourglass_On"
neighbour(key%,top,1)
P%<>top
count%+=1
ptr%>0
R%=
rec_no(k$,key%,P%)
>#
R%>highest%
highest%=R%
?1 !ptr%=R%:$(ptr%+4)=k$:ptr%+=4+KL%(key%)+1
SHflag%?R%=0
P%=
neighbour(key%,P%,1)
"Hourglass_Off"
=count%
analyse(func%)
L%,S%,pos%,N%,values%,key%,S$,title$
S$(),N%(),R%()
print_init("W")
format$="analyse"
func%<0
L%=6
key%=func%:L%=KL%(key%)
L%>8
Tab%(2)=Lmargin%+L%+6
Tab%(2)=Lmargin%+14
spacer$,"|")>0
spacer$="|"
O8maxhead%=0:fspace%=18:hspace%=5*36-18:PrintFields%=2
Tab%(3)=Tab%(2)+6
LenLine%=Tab%(3)+6
func%<0
S% title$="Analysis of date field"
T$ S$="Name: "+Tag$(Fieldnumber%)
Heading$="Month"
VV TextName$=$database%+".PrintJobs.DateAn"+Tag$(Fieldnumber%):$SaveName%=TextName$
X title$="Analysis of index"
S$="Name: "+Index$(key%)
Heading$="Contents"
[U TextName$=$database%+".PrintJobs.IndAn"+Tag$(Fieldnumber%):$SaveName%=TextName$
end_line
send_title(title$)
send_title(S$)
send_title(
store_string(Heading$,Lmargin%,
store_rec_num(-2):
store_string(" Number",Tab%(2),
"Hourglass_On"
func%<0
analyse_date
analyse_index
"Hourglass_Off"
store_string("Total",Lmargin%,
store_rec_num(-2):
store_string(
justify(
(N%),3,2,""),Tab%(2),
screen_list
analyse_index
P%,ptr%,K$,k%
K$="***"
neighbour(key%,top,1)
P%<>top
R%=
rec_no(k$,key%,P%)
u#
k$<>K$
values%+=1:K$=k$
v P%=
neighbour(key%,P%,1)
S$(values%),N%(values%),R%(values%)
K$="***"
neighbour(key%,top,1)
P%<>top
R%=
rec_no(k$,key%,P%)
k$<>K$
~: ptr%+=1:K$=k$:S$(ptr%)=K$:N%(ptr%)=1:R%(ptr%)=R%
N%(ptr%)+=1
P%=
neighbour(key%,P%,1)
I%=1
ptr%
U S$=S$(I%):
S$=""
S$="<null>"
isadate%
transform_date(KL%(key%),S$)
S$=
stripright(S$,"#")
store_rec_num(R%(I%))
store_string(S$,Lmargin%,
store_string(
justify(
(N%(I%)),3,2,""),Tab%(2),
N%+=N%(I%)
store_string("No. of values",Lmargin%,
store_rec_num(-2)
store_string(
justify(
(values%),3,2,""),Tab%(2),
analyse_date
S$(12),N%(12)
YS$()="<null>","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"
*dbasehandle%=
($database%+".Database")
neighbour(key%,top,1)
P%<>top
R%=
rec_no(k$,key%,P%)
readsmarray(dbasehandle%,R%)
S$=F$(Fieldnumber%)
S$<>""
M%=
S$,4,2))
N%(M%)+=1
N%(0)+=1
P%=
neighbour(key%,P%,1)
close_file(dbasehandle%)
I%=0
store_string(S$(I%),Lmargin%,
store_string(
justify(
(N%(I%)),3,2,""),Tab%(2),
N%+=N%(I%)
update_stats
$filesize%=
(RA%)
$Records%=
(RA%)
$used%=
(RU%)
#$percent%=
(RU%*100/RA%))+"%"
Keypress processing --------------------------------------------------
set_keyboard(wi%,ic%)
flag%,T%
selected(prefsW%,21)
T%=0
LastTable%
wi%=tableW%(T%)
flag%=
flag%
oldwindow%=wi%:oldicon%=ic%
wi%
mainW%:
chartype%((ic%+1)
$
2,4:
"OS_Byte",202,0,239
!
"OS_Byte",202,16,111
accessW%:
uc%
"OS_Byte",202,0,239
"OS_Byte",202,caps%,111
"OS_Byte",202,caps%,111
"OS_Byte",118
process_key
wi%,ic%
printing%
indexing%
N$,T%
"Wimp_GetCaretPosition",,block%
4wi%=block%!0:ic%=block%!4:key_pressed%=block%!24
T%=0
LastTable%
wi%=tableW%(T%)
Tablenumber%=T%
!Scroller%=
scroller_num2(wi%)
key_pressed%
store
retrieve(scratchpad$)
wi%
mainW%:
main_press(wi%,ic%)
passW%:
dbox_press(4,18,0,0,0)
aclW%:
dbox_press(9,11,0,0,0)
changeW%:
dbox_press(3,6,queryW%,0,0)
tabcreateW%:
dbox_press(2,3,scrollW%,0,MaxCols%*2+1)
scrollW%:
scroll_press
saveW%,savesubW%:
dbox_press(1,3,0,0,0)
tableW%(Tablenumber%):
table_press(Tablenumber%)
scrollerW%(Scroller%):
scroller_press(wi%,ic%,Scroller%,key_pressed%)
printW%:
dbox_press(12,33,0,0,0)
printerW%:
dbox_press(44,67,0,0,0)
createW%:
create_press
accessW%:
dbox_press(3,2,0,0,0)
keyW%:
dbox_press(31,36,0,0,0)
matchW%:
dbox_press(0,6,0,0,0)
moveW%:
dbox_press(1,3,0,0,0)
calcW%:
dbox_press(1,-1,0,0,0)
mergeW%:
dbox_press(4,5,0,0,0)
mergebaseW%:
dbox_press(1,9,0,0,0)
reformW%:
dbox_press(2,1,0,0,0)
sizeW%:
dbox_press(4,5,0,0,0)
csvW%:
dbox_press(9,10,0,0,0)
prefsW%:
dbox_press(39,40,0,0,0)
searchW%:
key_pressed%=15
#
search_click(searchW%,9,4)
!
dbox_press(8,10,0,0,0)
helpW%:
dbox_press(7,20,0,0,0)
queryW%:
query_press(oldquery%)
inputW%:
dbox_press(2,3,0,0,0):
$Params%=""
set_caret(0,wi%,1)
keypadW%:
customise%
(libfunc$+"_press(wi%,ic%)")
key_pressed%
13,384,398,399:
Ignore these
query_press(wi%)
key_pressed%
wi%
.
matchW%,filterW%:
mouse(0,0,4,wi%,0)
$
moveW%:
mouse(0,0,4,wi%,1)
&
changeW%:
mouse(0,0,4,wi%,3)
'
savesubW%:
set_caret(0,wi%,2)
query_click(queryW%,2,4)
shut_window(wi%):
restore_caret(starthere%)
384:
wi%<>matchW%
match(0,0):
set_caret(0,queryW%,0)
398:
wi%
&
changeW%:
set_caret(0,wi%,0)
'
savesubW%:
set_caret(0,wi%,2)
399:
wi%
&
changeW%:
set_caret(0,wi%,1)
'
savesubW%:
set_caret(0,wi%,2)
416:
select(printW%,32):
deselect(printW%,31)
position_window(printW%,0,0,0,0,0,0)
set_caret(0,printW%,26)
385,386,387,388,389,390,391,392,393,401,402,403,404,405,406,407,408,409,417,418,419,420,421,422,423,424,425,458,474,490,459,475,491,507:
button_action(key_pressed%)
"OS_Byte",228,1:
"Wimp_ProcessKey",key_pressed%
main_press(wi%,ic%)
selected(passW%,10)
"Wimp_ProcessKey",key_pressed%:
icon%
flash%
set_icon(wi%,field%(flash%),state%):flash%=
trim(wi%,ic%)
validate(Fieldnumber%,T%,N$)=
"(changed%=
update_calcs(Fieldnumber%)
key_pressed%
select_range(1,fields%,
(-1)
S$="ALL"
S$="TOTALS"
Modify%
balance(key%):
print_tree(key%,S$):
rectify_address(key%)
len%(Fieldnumber%)>=10
)+ $Rf%(Fieldnumber%)=
convert_date(4)
*G
len%(Fieldnumber%)>=8
$Rf%(Fieldnumber%)=
convert_date(2)
redraw_icon(wi%,field%(Fieldnumber%))
check_record
template%=1:
display(key%,-1)
/5 fieldsM%=
field_menu(items%,2+(printorder$=""))
tick_one(fieldsM%,0,fields%-1,Fieldnumber%-1)
"Wimp_GetPointerInfo",,block%
show_menu(fieldsM%,!block%-150,block%!4+16)
fieldfunc$="CtrlF"
5( $ChangeTitle%="Field: "+Fieldname$
position_window(changeW%,0,0,0,0,0,0):
set_caret(0,changeW%,0)
"OS_CLI","Filer_OpenDir "+$database%+".Indexes"
set_up_field_menu
:A keyfunc$="Create index":$KeyTitle%=keyfunc$+": "+Fieldname$
shade_key_icons(
deselect(keyW%,30):
deselect(keyW%,35):
deselect(keyW%,37)
position_window(keyW%,0,0,0,504,0,0):
set_caret(0,keyW%,13)
?0 keyfunc$="Current key":$KeyTitle%=keyfunc$
set_keydata(key%):
shade_key_icons(
position_window(keyW%,0,0,0,504,0,0)
set_up_field_menu:
LastTable%<>-1
position_window(linkW%,0,0,0,0,0,0)
(-2)
(-102)
markpane%=
markpane%
markpane%
G9 !block%=mainW%:
"Wimp_GetWindowState",,block%
H@
update_pane(markW%,0,block%!16-block%!8+2,696,62,0,0)
I9
close_window(markW%):
mark_click(markW%,1,4)
J
L&
Fieldnumber%=Lastwritable%
M!
close_window(relateW%)
N-
check_record
display(key%,-1)
P5 Fieldnumber%=
next_editable(Fieldnumber%,1)
Q
R,
selected(prefsW%,19)
relations
(-1)
VC
lit(printM%,5)
position_window(pselectW%,0,0,0,0,0,0)
W3
position_window(extracalcW%,0,0,0,0,0,0)
X4 calc%=Ecalc%:
set_up_calc(extracalcW%,calc%)
filter%
\T
field%(buttonfield%(0,22))>0
filter(mainW%,4,
filter(keypadW%,4,
].
selected(passW%,14)
match(0,0)
query_click(queryW%,2,4)
"OS_CLI","Filer_OpenDir "+$database%+".PrintJobs"
"OS_CLI","Filer_OpenDir "+$database%+".ValTables"
"OS_CLI","Filer_OpenDir "+$database%+".PrintRes"
19:starthere%=field%(Fieldnumber%):$StartHere%=Tag$(Fieldnumber%):
redraw_icon(prefsW%,45):
Access%
set_caret(0,mainW%,starthere%)
len%(Fieldnumber%)>=8
T$=
g-
T$,3,1)=$timesep%:
T$,6,1)=$timesep%
$Rf%(Fieldnumber%)=T$
i.
redraw_icon(wi%,field%(Fieldnumber%))
get_winpos
selected(passW%,13)
n: x%=(ScreenWidth%-w%)
2:y%=(ScreenHeight%-h%)
o, choice$(2)="Export":
act_on_csv_menu
clear_selection
keypad_click(keypadW%,1,4)
close_it(linkW%):
close_it(keyW%):
close_it(csvW%)
30:Fieldnumber%=
first_writable:
set_caret(0,wi%,field%(Fieldnumber%))
384:
selected(passW%,14)
x6
qbe%
mouse(0,0,4,matchW%,0)
match(0,0)
394:
ShowTools%
open_window(keypadW%)
398:Fieldnumber%=
next_editable(Fieldnumber%,1)
selected(prefsW%,19)
relations
399:Fieldnumber%=
next_editable(Fieldnumber%,-1)
selected(prefsW%,19)
relations
400:
mouse(0,0,4,matchW%,0):
clear_selection
416:
select(printW%,32):
deselect(printW%,31)
position_window(printW%,0,0,0,0,0,0)
set_caret(0,printW%,26)
385,386,387,388,389,390,391,392,393,401,402,403,404,405,406,407,408,409,417,418,419,420,421,422,423,424,425,458,474,490,459,475,491,507:
button_action(key_pressed%)
433:
reveal(
434:
reveal(
441:
protect(wi%,ic%,Fieldnumber%)
"OS_Byte",228,1:
"Wimp_ProcessKey",key_pressed%
selected(prefsW%,21)
chartype%(Fieldnumber%)
$
2,4:
"OS_Byte",202,0,239
!
"OS_Byte",202,16,111
"OS_Byte",118
"OS_Byte",15,0
next_editable(F%,z%)
S%,V%,row%,V$,end%
F%+=z%
F%>fields%
F%=1
F%<1
F%=fields%
3 V%=chartype%(F%):V$=vtype$(V%):ic%=field%(F%)
((V$="E"
len%(F%)>0)
V$="L")
get_icon_cols(wi%,ic%)<>winback%*17
"E":
wi%=mainW%
set_caret(0,wi%,ic%)
"L":
S%=
scroller_number(F%)
wi%=scrollerW%(S%)
z%=1
ic%=0:row%=0
ic%=scrolldata%(S%,6)-1
2 row%=scrolldata%(S%,6)
scrolldata%(S%,8)
end%=
set_caret(0,wi%,ic%)
scroll_it(wi%,row%,end%)
user_menu(F%)
button_action(K%)
wi%,ic%,e%,flag%
button%=
key_assigned(K%)
button%=-1
"Wimp_ProcessKey",K%:
### No keypad action ###
button%
23:e%=-1:button%=13
24:button%=14:flag%=
28:button%=18:flag%=
Alter button% so that correct ic% is calculated
ShowTools%
:ic%=button%:wi%=keypadW%
:ic%=field%(buttonfield%(0,button%)):wi%=mainW%
flag%
button%+=10
Put button% back as it was
button%
invert(wi%,ic%):
filter(wi%,4,
selected(wi%,ic%))
invert(wi%,ic%):
allow_search(wi%,e%):
invert(wi%,ic%)
invert(wi%,ic%):
display(key%,-2):
invert(wi%,ic%)
invert(prefsW%,21)
val_on_off(
selected(prefsW%,21))
ic%>0
shade(wi%,ic%,
selected(prefsW%,21))
shaded(wi%,ic%)
1
wi%=keypadW%
ic%>0
invert(wi%,ic%)
&
mouse(0,0,4,keypadW%,button%)
1
wi%=keypadW%
ic%>0
invert(wi%,ic%)
key_assigned(pressed%)
I%=-1
I%+=1
I%=28
buttonfield%(1,I%)=pressed%
buttonfield%(1,I%)=pressed%
dbox_press(ok%,esc%,wi2%,down%,up%)
trim(wi%,ic%)
wi%
accessW%:
key_pressed%
M
next_writable(wi%,ic%,1,1,wi2%,down%)
mouse(0,0,4,wi%,ok%)
#
mouse(0,0,4,wi%,esc%)
7
398:f%=
next_writable(wi%,ic%,1,0,wi2%,down%)
6
399:f%=
next_writable(wi%,ic%,-1,0,wi2%,up%)
+
"Wimp_ProcessKey",key_pressed%
key_pressed%
selected(prefsW%,41)
next_writable(wi%,ic%,1,1,wi2%,down%)
mouse(0,0,4,wi%,ok%):
restore_caret(starthere%)
>
mouse(0,0,4,wi%,esc%):
restore_caret(starthere%)
7
398:f%=
next_writable(wi%,ic%,1,0,wi2%,down%)
6
399:f%=
next_writable(wi%,ic%,-1,0,wi2%,up%)
#
wi%=tabcreateW%
ic%=0
: $tabcol%=
(MaxCols%):
redraw_icon(tabcreateW%,8)
; !block%=scrollW%:
"Wimp_GetWindowState",,block%
= block%!24=-MaxCols%*44:
"Wimp_OpenWindow",,block%
385,386,387,388,389,390,391,392,393,401,402,403,404,405,406,407,408,409,417,418,419,420,421,422,423,424,425,458,474,490,506,459,475,491,507:
$
button_action(key_pressed%)
>
"OS_Byte",228,1:
"Wimp_ProcessKey",key_pressed%
scroll_press
row%
trim(wi%,ic%)
key_pressed%
13,398:f%=
next_writable(wi%,ic%,1,0,tabcreateW%,0)
399:f%=
next_writable(wi%,ic%,-1,0,tabcreateW%,8)
"Wimp_ProcessKey",key_pressed%
"Wimp_GetCaretPosition",,block%
!block%=scrollW%
ic%=block%!4
ic%=0
row%=ic%
0$tabcol%=
(row%):
redraw_icon(tabcreateW%,8)
scroll_it(scrollW%,row%,
table_press(T%)
icons%,row%,scrollrow%,visible_rows%
trim(wi%,ic%)
icons%=Rows%*(TabFields%+1)
key_pressed%
ic%<icons%-1
ic%+=1
ic%=0
398:
ic%<icons%-TabFields%-1
ic%+=(TabFields%+1)
ic%=ic%
(TabFields%+1)
399:
ic%>=TabFields%+1
ic%-=(TabFields%+1)
ic%=icons%-TabFields%-1+ic%
(TabFields%+1)
"Wimp_ProcessKey",key_pressed%
set_caret(0,tableW%(T%),ic%)
'row%=(ic%
(TabFields%+1))-NewTab%
8!block%=tableW%(T%):
"Wimp_GetWindowState",,block%
-visible_rows%=(block%!16-block%!8)
44-1
scrollrow%=-(block%!24
row%-scrollrow%>visible_rows%
block%!24=(visible_rows%-row%)*44:
"Wimp_OpenWindow",,block%
row%<scrollrow%
block%!24=-row%*44:
"Wimp_OpenWindow",,block%
create_press
shaded(wi%,29):
shaded(wi%,18)
dbox_press(18,41,0,0,0)
shaded(wi%,29)
dbox_press(29,41,0,0,0)
menu_select
P%,Q%,I%,M%,field%,umenu%
(&choice1%=!block%:choice2%=block%!4
)(choice3%=block%!8:choice4%=block%!12
menuhandle%
fontM%:
"Font_DecodeMenu",,fontM%,block%,block%+255,255
"Wimp_DecodeMenu",,menuhandle%,block%,choices%
I%=1
Q%=
$choices%,".",P%+1)
1& choice$(I%)=
$choices%,P%,Q%-P%)
P%=Q%+1
"Wimp_GetPointerInfo",,block%
x%=!block%:y%=block%!4
redo%=block%!8=1
menuhandle%
fontM%:
display_font_name(
getstr(block%+255))
iconbarM%:
act_on_icon_bar_menu
mainM%:
act_on_main_menu
designM%:
act_on_create_menu
tableM%:
act_on_table_menu(choice$(1))
listM%:
act_on_text_menu
delimiterM%:
act_on_csv_sep
terminatorM%:
act_on_csv_term
scrolltermM%:
act_on_csv_scrollterm
markM%:
act_on_mark_menu
ftypeM%(0):
act_on_fieldtype_menus(0)
ftypeM%(1):
act_on_fieldtype_menus(1)
ftypeM%(2):
act_on_fieldtype_menus(2)
ftypeM%(3):
act_on_fieldtype_menus(3)
ftypeM%(4):
act_on_fieldtype_menus(4)
ftypeM%(5):
act_on_fieldtype_menus(5)
ftypeM%(6):
act_on_fieldtype_menus(6)
ftypeM%(7):
act_on_fieldtype_menus(7)
keystrokeM%:
act_on_keypad_menu
valtablesM%:
act_on_menu_of_tables
fieldsM%:
act_on_menu_of_fields
indexesM%:
act_on_menu_of_indexes
userM%:
act_on_user_menu
mergecomM%:
tick_one(mergecomM%,0,2,choice1%):
set_mergecom_icons
customise%
(libfunc$+"_select(menuhandle%)")
quit%
redo%
show_menu(menuhandle%,menux%,menuy%)
display_font_name(S$)
S$,"\F")
S$,P%+2)
S$,"\")
S$,P%-1)
text(printerW%,fontdisplay%)=S$
redraw_icon(printerW%,fontdisplay%)
act_on_user_menu
S%,menic%,flags%,wi%,ic%,L%,choice$
c0menic%=userM%+28+choice1%*24:flags%=menic%!8
(flags%
(1<<8))=0
choice$=
$(menic%+12),12)
choice$=$(menic%!12)
find_insertion_icon(menufield%)
insert_text(wi%,ic%,menufield%,choice$)
find_insertion_icon(F%)
chartype%(F%)
64,65,66,67:
S%=
scroller_number(F%)
"Wimp_GetCaretPosition",,block%:wi%=!block%:ic%=block%!4
wi%<>scrollerW%(S%)
wi%=scrollerW%(S%):ic%=0
wi%=mainW%:ic%=field%(F%)
insert_text(wi%,ic%,F%,S$)
fix%(F%)<>0
fix_point(S$,F%)
buffer_length(wi%,ic%)
(S$)<=L%
text(wi%,ic%)=S$
redraw_icon(wi%,ic%)
set_caret(0,wi%,ic%)
wi%=mainW%
changed%=
ScrollChanged%=
softerror(""""+S$+"""",7)
act_on_mark_menu
choice$(1)
"Include":
tick(markM%,0,
tick(markM%,1,
val(markW%,0)="Snull,yes"
"Exclude":
tick(markM%,1,
tick(markM%,0,
val(markW%,0)="Snull,no"
redraw_icon(markW%,0)
warn_of_marks
act_on_main_menu
choice$(1)
"Information":
count(key%,RU%):
update_stats
position_window(miscW%,x%-200,y%-300,0,0,0,0)
"Miscellaneous":
act_on_misc_menu
"Print":
act_on_print_menu
"Validation":
act_on_validation_menu
"Index":
act_on_index_menu
"Show keypad Tab":
ShowTools%
position_window(keypadW%,-1,-1,0,0,0,0)
"Export subset":
? export%=
:$SubTitle%="Export subset":savefunc$=choice$(1)
+ $SubName%=
dir($database%)+".!Subset"
. $SubSprite%="snew_appl;Pptr_hand,4,0;R2"
position_window(savesubW%,x%-244,y%-161,0,0,0,0):
set_caret(0,queryW%,0)
"CSV files":
act_on_csv_menu
"Undo changes":
restore(1,fields%,"",-1)
"Help":
"Wimp_StartTask","<Pbase$Dir>.!Help"
act_on_field_menu
act_on_index_menu
choice$(2)
"Show details ^K":
show_key
"Delete":
confirm(
msg("Err147,"+choice$(3)))
remove_index(choice$(3),
"Show files ^I":
"OS_CLI","Filer_OpenDir "+$database%+".Indexes"
show_key
show_key
-$KeyTitle%=choice$(1):keyfunc$=choice$(1)
set_keydata(key%):
shade_key_icons(
position_window(keyW%,x%-284,y%-252,0,504,0,0)
act_on_csv_menu
choice$(2)
"Export":
9 $SubTitle%="Export CSV file":savefunc$="Export CSV"
C $SubName%=$database%+".PrintJobs."+
set_up_save_box(2)+"file"
position_window(savesubW%,x%-244,y%-161,0,0,0,0):
set_caret(0,queryW%,0)
"Options":
$CSVTitle%="CSV options"
shade(csvW%,0,
text(csvW%,9)="Accept"
position_window(csvW%,x%-350,y%-180,700,440,0,0)
set_up_save_box(box%)
f$,t$,v$
text(csvW%,14)
"Comma":f$="CSV"
"TAB":f$="TSV"
:f$="?SV"
t$="dfe":Type%=&dfe
&v$="sfile_"+t$+";Pptr_hand,4,0;R2"
box%=1
$SaveSprite%=v$
$SubSprite%=v$
act_on_misc_menu
choice$(2)
"Move/delete":
deselect(moveW%,
selected_esg(moveW%,1)):
select(moveW%,4)
shade(moveW%,8,
shade(moveW%,9,
shade(moveW%,12,
shade(moveW%,13,
' source%=file%:dest%=(file%+1)
text(moveW%,7)=$Subfile%(source%):$
text(moveW%,8)=$Subfile%(dest%):$
text(moveW%,1)="Move"
position_window(moveW%,x%-253,y%-232,0,0,0,0):
set_caret(0,queryW%,0)
"Set passwords":
position_window(passW%,x%-213,y%-388,0,0,0,0):
set_caret(0,passW%,2)
"Field colours":
position_window(colW%,x%-213,y%-388,0,0,0,0)
"Edit template ^E":
check_record
template%=1:
display(key%,-1)
"Name subfile":
choice3%
H P%=
$RecInfo%,"Record")-1:$RecInfo%=$Subfilename%+
$RecInfo%,P%)
& $Subfile%(file%)=$Subfilename%
asterisk(
"Rename database":
choice3%=0
rename_database($NewName%)
act_on_print_menu
choice$(2)
"Print","Create report":
match(x%-396,y%-131)
"Show resources ^R":
"OS_CLI","Filer_OpenDir "+$database%+".PrintRes"
"Options":
select(printW%,32):
deselect(printW%,31)
position_window(printW%,x%-458,y%-401,0,0,0,0)
set_caret(0,printW%,26)
"Save query":
- $SaveName%=$database%+".PrintRes.Query"
2 savefunc$=choice$(2):
save_click(saveW%,1,4)
"Numeric fields":
position_window(pselectW%,0,0,0,0,0,0)
"Extra calculations":
position_window(extracalcW%,0,0,0,0,0,0)
2 calc%=Ecalc%:
set_up_calc(extracalcW%,calc%)
"Save selection":
1 $SaveName%=$database%+".PrintRes.Selection"
2 savefunc$=choice$(2):
save_click(saveW%,1,4)
"Show jobs done ^P":
"OS_CLI","Filer_OpenDir "+$database%+".PrintJobs"
"Clear selection ^Z":
clear_selection
"Display selection":
get_calc(
(choice$(3)))
"Select all ^A":
select_range(1,fields%,
act_on_validation_menu
choice$(2)
"Create table":
LastTable%=MaxTabs%-1
4
softerror("tables,"+
(MaxTabs%)+",Tabs",23)
F $
text(tabcreateW%,0)="":$
text(tabcreateW%,1)="":$tabcol%="0"
I%=0
MaxCols%*2+1
$
text(scrollW%,I%)=""
*
set_icon_cols(tabcreateW%,13,&28)
*
set_icon_cols(tabcreateW%,14,&07)
W
position_window(tabcreateW%,x%-241,y%-301,0,0,0,0):
set_caret(0,tabcreateW%,0)
"Display table":
choice3%>=0
Tablenumber%=choice3%
%
show_table(Tablenumber%,0,0)
"Show files ^Q":
"OS_CLI","Filer_OpenDir "+$database%+".ValTables"
act_on_field_menu
choice$(2),1)="."
choice$(2)=
choice$(2),2)
choice$(2)
"Create index":
= keyfunc$=choice$(2):$KeyTitle%=keyfunc$+": "+Fieldname$
shade_key_icons(
deselect(keyW%,30):
deselect(keyW%,35):
deselect(keyW%,37)
position_window(keyW%,x%-284,y%-252,0,504,0,0):
set_caret(0,keyW%,13)
"Analyse index":
analyse(
is_a_key(Fieldnumber%))
"Analyse months":
analyse(-1)
"Link to table":
position_window(linkW%,x%-350,y%-129,0,0,0,0)
"Calculations","Combine fields","Set base value":
position_window(calcW%,0,0,0,0,0,0):
set_caret(0,calcW%,0)
"Global changes":
position_window(changeW%,x%-252,y%-214,0,0,0,0):
set_caret(0,changeW%,0)
"Start editing ^S":
&] starthere%=field%(Fieldnumber%):$StartHere%=Tag$(Fieldnumber%):
redraw_icon(prefsW%,45)
Access%
set_caret(0,mainW%,starthere%)
"Remove text file","Remove sprite","Remove drawfile","Unlink directory","Unlink file","Blank list":
chartype%(Fieldnumber%)
+4 link$(Fieldnumber%)="":$Rf%(Fieldnumber%)=""
,: $
val(mainW%,field%(Fieldnumber%))="R5;Ssmall_dir"
-1
redraw_icon(mainW%,field%(Fieldnumber%))
/4 link$(Fieldnumber%)="":$Rf%(Fieldnumber%)=""
07 $
val(mainW%,field%(Fieldnumber%))="R5;Saction"
11
redraw_icon(mainW%,field%(Fieldnumber%))
2"
60:$Rf%(Fieldnumber%)=""
3F $
val(mainW%,field%(Fieldnumber%))="R5;Pptr_ext,8,4;Sdropfile"
41
redraw_icon(mainW%,field%(Fieldnumber%))
5H
delete_blob(Fieldnumber%,object$,mainW%,field%(Fieldnumber%))
asterisk(
"Save text file":
9I $SaveName%=$database%+".PrintJobs.TextFile":
save_click(saveW%,1,4)
"Save sprite":
;G $SaveName%=$database%+".PrintJobs.Sprite":
save_click(saveW%,1,4)
"Save drawfile":
=I $SaveName%=$database%+".PrintJobs.DrawFile":
save_click(saveW%,1,4)
"Save as list":
?1 $SaveName%=$database%+".PrintJobs.TextList"
@2 savefunc$=choice$(2):
save_click(saveW%,1,4)
"Save as CSV":
BE $SaveName%=$database%+".PrintJobs."+
set_up_save_box(1)+"file":
CC savefunc$=choice$(2):writescroller%=
save_click(saveW%,1,4)
"Undo changes":
restore(Fieldnumber%,Fieldnumber%,"",-1)
"Compact sequence":
compact(Fieldnumber%)
compact(F%)
sequenceval$,V$
is_a_key(F%)
key%:
confirm(
msg("Err128"))
N'
split_link(F%,V$,sequenceval$)
V$=sequenceval$
"Hourglass_On"
Q. dbasehandle%=
($database%+".Database")
R! P%=
neighbour(key%,top,1)
S,
scan_file("P%<>top",key%,file%,7,1)
"Hourglass_Off"
U!
close_file(dbasehandle%)
V% calc$(F%)=V$+"|"+sequenceval$
save_calcs:
save_keys
softerror(Tag$(F%),116)
softerror(Tag$(F%),127)
act_on_keypad_menu
choice$(1)
"Defaults":
load_functionkeys
"Save choices":
save_fkeys
"List keys":
list_fkeys
act_on_csv_sep
choice$(1)
"Comma":sep$=","
"TAB":sep$=
"CR":sep$=
"LF":sep$=
sep$=$Delim%
tick_one(menuhandle%,0,3,choice1%)
text(csvW%,14)=choice$(1)
redraw_icon(csvW%,14)
act_on_csv_term
choice$(1)
"CR":term$=
(13)
"LF":term$=
"CR LF":term$=
(13)+
"LF CR":term$=
(10)+
"CR CR":term$=
(13)+
"LF LF":term$=
(10)+
:term$=$Termin%
tick_one(menuhandle%,0,5,choice1%)
text(csvW%,15)=choice$(1)
redraw_icon(csvW%,15)
act_on_csv_scrollterm
choice$(1)
"Semicolon":scrollterm$=";"
"Comma":scrollterm$=","
"TAB":scrollterm$=
"Space":scrollterm$=" "
:scrollterm$=$Scrterm%
tick_one(menuhandle%,0,3,choice1%)
text(csvW%,27)=choice$(1)
redraw_icon(csvW%,27)
act_on_text_menu
choice$(1),4)
"Save":
$SaveName%=TextName$
/ $SaveSprite%="sfile_fff;Pptr_hand,4,0;R2"
2 savefunc$=choice$(1):
save_click(saveW%,1,4)
"Sort":
choice2%=1
z%=-1
z%=1
sort_list(sort_textcol%,z%)
"Shri":
remove_white_space(format$)
screen_list
"Disc":
lose_list
act_on_create_menu
choice$(1)
"Create field":
selected_esg(createW%,1)=54
% wht%=730:
sformat(createW%,
"
set_scroll_def(0,1,
'
wht%=640:
sformat(createW%,
"
set_scroll_def(0,0,
position_window(createW%,x%-425,y%-320,0,wht%,0,0):
set_caret(0,createW%,4)
"Edit field":
vtype$(chartype%(Fieldnumber%))="L"
wht%=730
wht%=640
position_window(createW%,x%-425,y%-320,0,wht%,0,0):
set_caret(0,createW%,4)
"Fields created":
choice2%>=0
design_field(2,choice2%*2+1,
"Save form file":
# $SaveName%=$database%+".Form"
2 savefunc$=choice$(1):
save_click(saveW%,1,4)
"Default database":
save_form($database%+".Form")
first_writable>0
default_key
#
defaults($database%,100,0)
softerror("",35)
"Primary key":
$ fieldsM%=
field_menu(items%,1)
F%=
first_writable
0 starthere%=field%(F%):$StartHere%=Tag$(F%)
$KeyTitle%=choice$(1)
keyfunc$=choice$(1)
case%(0)=
set_keydata(0)
shade_key_icons(
shade(keyW%,37,
position_window(keyW%,x%-284,y%-252,0,504,0,0):
set_caret(0,keyW%,13)
"Quit design":
quit_design
quit_design
F%,real$,visible$
nosave%=
adjust_on(
save_form($database%+".Form")
save_calcs
$Reformatted%<>""
close_window(mainW%)
complete(6)
get_it_in($Original%)
complete(6)
do_reformat
get_it_in($database%):
do_reformat
$Reformatted%=$database%
softerror("",36):
reformat($Reformatted%)
softerror($Reformatted%+",",178):
close_window(reformW%)
&db$=$Reformatted%:$Reformatted%=""
get_it_in(db$)
complete(6)
selected(reformW%,11)
softerror($database%+","+$Original%,161)
F%,I%,R$,V$,old$,new$
F%=1
fields%
chartype%(F%)
6,7:
split_link(F%,R$,V$)
'
calc_formula(F%,calcW%,1,4,V$)
menfield%(I%,0)<>-1
= buttonfield%=menfield%(I%,0):datafield%=menfield%(I%,1)
Tag$(buttonfield%)<>Tag$(datafield%)
4
Datafield for menu must have a renamed tag
C old$=Tag$(buttonfield%)+"menu":new$=Tag$(datafield%)+"menu"
U
"OS_CLI","Rename "+$database%+".Menus."+old$+" "+$database%+".Menus."+new$
+ Tag$(buttonfield%)=Tag$(datafield%)
I%+=1
save_form($database%+".Form")
store_menu_inf
F%,I%,datafield%
menfield%()=-1
F%=1
fields%
chartype%(F%)=33
datafield%=0
datafield%+=1
#
Tag$(datafield%)=Tag$(F%)
5 menfield%(I%,0)=F%:menfield%(I%,1)=datafield%
I%+=1
act_on_fieldtype_menus(m%)
currenttype%=choice1%
+fieldtype%=?(flist%(m%)+currenttype%+1)
tick_one(menuhandle%,0,lasttype%,choice1%)
update_box
fieldtype%
64,65,66,67:
set_scroll_def(0,fieldtype%-63,
set_scroll_def(0,0,
act_on_menu_of_tables
Tablenumber%=choice1%
$$Tablename%=table$(Tablenumber%)
tick_one(menuhandle%,0,LastTable%,choice1%)
redraw_icon(linkW%,0)
act_on_menu_of_fields
(choice$(1)):
Items start with field-number
fieldfunc$
"mergecom":mergefield%=F%:
set_mergecom_icons
"getcalc":
get_calc(F%)
"calc":
enter_tag(Tag$(F%))
"create":
design_field(2,F%*2-1,
"help":
Match_tag%=F%
> $
text(helpW%,0)=Tag$(Match_tag%):
redraw_icon(helpW%,0)
tick_one(menuhandle%,0,items%,choice1%)
"CtrlF":
printorder$=""
Fieldnumber%=F%
%A
chartype%(Fieldnumber%)<6
chartype%(Fieldnumber%)=8
&3
set_caret(0,mainW%,field%(Fieldnumber%))
'.
selected(prefsW%,19)
relations
(
get_calc(F%)
"0","1","2","3":
keyfield%=
(fieldfunc$)
keyfunc$<>"Current key"
."
ticked(fieldsM%,F%-1)
/O keyfield%(keyfield%)=0:
kcycle(keyfield%(keyfield%),4*keyfield%+12,0)
1P keyfield%(keyfield%)=F%:
kcycle(keyfield%(keyfield%),4*keyfield%+12,0)
22
tick_one(menuhandle%,0,items%,choice1%)
3
get_calc(F%)
F%>MaxFields%+2
calc%=F%-MaxFields%-3
position_window(extracalcW%,0,0,0,0,0,0)
set_up_calc(extracalcW%,calc%)
act_on_table_menu(ch$)
ch$="Save":
C2 $SaveName%=$database%+".ValTables."+$tableM%
D4 savefunc$="Save table":
save_click(saveW%,1,4)
ch$="Save as CSV":
FF $SaveName%=$database%+".PrintJobs."+
set_up_save_box(1)+$tableM%
G9 savefunc$=ch$:writetable%=
save_click(saveW%,1,4)
ch$="Clear":
clear_table(Tablenumber%)
ch$="Print":
print_table(Tablenumber%)
ch$,4)="Sort":
sort_table(Tablenumber%,sort_tabcol%)
ch$="Undo all":
restore_table(Tablenumber%)
ch$="Undo change":
restore_tabfield
ch$="Modify":
modify_table(Tablenumber%,tabcreateW%)
act_on_icon_bar_menu
choice$(1)
"Rename database":
choice2%=0
rename_database($NewName%)
"Help":
"Wimp_StartTask","<Pbase$Dir>.!Help"
"Utilities":
choice$(2)
"New primary key":
$KeyTitle%=choice$(2)
Y+ keyfunc$=choice$(2):
set_keydata(0)
(present%
2)=2
[/
select(keyW%,32):
deselect(keyW%,33)
\/
shade(keyW%,32,
shade(keyW%,33,
^/
select(keyW%,33):
deselect(keyW%,32)
_/
shade(keyW%,32,
shade(keyW%,33,
`
a.
shade_key_icons(
shade(keyW%,37,
bN
position_window(keyW%,x%-284,y%-303,0,606,0,0):
set_caret(0,keyW%,13)
c1
"New record format","Rebuild database":
d1
shade(reformW%,0,
shade(reformW%,2,
eE $Original%=$database%:$Reformatted%="!NewFormat":$Newform%=""
f5
position_window(reformW%,x%-237,100,0,0,0,0)
g
set_caret(0,reformW%,6)
h)
"Adjust format","Alter format":
check_record
adjust_on(
store_menu_inf
open_window(mainW%)
display(key%,-1)
n
"Merge databases":
pI $
text(mergebaseW%,2)=$database%:$
text(mergebaseW%,4)=$database%
qO
shade(mergebaseW%,4,
shade(mergebaseW%,7,
shade(mergebaseW%,1,
r $
text(mergebaseW%,3)=""
s8
position_window(mergebaseW%,x%-237,100,0,0,0,0)
t]
"Balance index ^B":
balance(key%):
print_tree(key%,"TOTALS"):
rectify_address(key%)
u1 S$=key$(key%):
case%(key%)
u(S$)
vA val$=
type(key%):
val$="VAL"
kl%=KL%(key%)
kl%=
w# addr=
search(S$,key%,2)
"Print index":
choice$(3)
z7
"All subfiles":
tick_one(indextreeM%,0,1,0)
{:
"Current subfile":
tick_one(indextreeM%,0,1,1)
|6
"Symmetrical":
tick_one(indextreeM%,2,3,2)
}5
"Root first":
tick_one(indextreeM%,2,3,3)
"Complete":
!
print_tree(key%,"ALL")
"Totals only":
$
print_tree(key%,"TOTALS")
&
print_tree(key%,"TOTALS")
(
"Print field data":
field_data
-
"Find duplicates":
duplicates(key%)
"Merge commands":
< mergefield%=1:$
text(mergecomW%,3)=Tag$(mergefield%)
0
tick_one(mergecomM%,0,2,0):$Expcol%="1"
set_mergecom_icons
0
position_window(mergecomW%,0,0,0,0,0,0)
"Close database":
check_record
$Reformatted%="":
Setting reformat name to "" cannot be done inside PROCexit because it is called during reformatting process where pathname must be remembered
"Preferences":
position_window(prefsW%,x%-371,150,0,0,0,0):
set_caret(0,prefsW%,1)
"Quit":
Access%
quit%=
check_record
quit%=
reveal(vis%)
F%,dic%,fic%
Modify%
F%=1
fields%
& dic%=desc%(F%):fic%=field%(F%)
hide%?F%=1
vis%
K%=
is_a_key(F%)
K%=-1
P
set_icon_cols(wi%,dic%,winback%*16+7):
set_icon_cols(wi%,fic%,04)
9
colour(K%,2):
set_icon_cols(wi%,fic%,04)
Y
set_icon_cols(wi%,dic%,winback%*17):
set_icon_cols(wi%,fic%,winback%*17)
make_index_menu
protect(wi%,ic%,F%)
Modify%
get_icon_cols(wi%,ic%)
2
set_icon_cols(wi%,ic%,04):hide%?F%=1
2
set_icon_cols(wi%,ic%,07):hide%?F%=0
protect%=
init_drag(wi%,ic%,dragtype%)
!block%=wi%
"Wimp_GetWindowState",,block%
x%=block%!4-block%!20
y%=block%!16-block%!24
block%!4=ic%
"Wimp_GetIconState",,block%
block%!8+=x%:minx%=block%!8
!block%!12+=y%:miny%=block%!12
!block%!16+=x%:maxx%=block%!16
!block%!20+=y%:maxy%=block%!20
dragtype%=6
5 block%!24=2*minx%-maxx%:block%!36=2*maxy%-miny%
block%!24=0:block%!36=ScreenHeight%
Cblock%!28=0:block%!32=ScreenWidth%:!block%=0:block%!4=dragtype%
wi%
mainW%,scrollerW%(Scroller%):
dragtype%
design%
. ficon%=ic%:
"Wimp_DragBox",,block%
D sprite$="file_fff":Filename$=Tag$(Fieldnumber%):Type%=&fff
A Start%=
text(wi%,ic%):End%=Start%+
text_length(wi%,ic%)
C
"Wimp_GetPointerInfo",,block%:x1%=!block%:y1%=block%!4
A !block%=wi%:block%!4=ic%:
"Wimp_GetIconState",,block%
@ block%!8=x1%:block%!12+=y%:block%!16=x1%:block%!20+=y%
P block%!24=0:block%!36=ScreenHeight%:block%!28=0:block%!32=ScreenWidth%
7
"DragASprite_Start",&C5,1,sprite$,block%+8
<
design%
ficon%=ic%:
"Wimp_DragBox",,block%
mergecomW%:
"DragASprite_Start",&C5,1,"file_fff",block%+8
saveW%:
! sprite$=
$SaveSprite%,2,8)
"DragASprite_Start",&C5,1,sprite$,block%+8
savesubW%:
sprite$=
$SubSprite%,2,8)
"DragASprite_Start",&C5,1,sprite$,block%+8
mergebaseW%:
! sprite$=
$MergeSprite%,2,8)
"DragASprite_Start",&C5,1,sprite$,block%+8
reformW%:
"DragASprite_Start",&C5,1,"new_appl",block%+8
passW%:
sprite$=
$LogSprite%,2,9)
"DragASprite_Start",&C5,1,sprite$,block%+8
aclW%:
sprite$=
$AclSprite%,2,8)
"DragASprite_Start",&C5,1,sprite$,block%+8
"Wimp_DragBox",,block%
end_drag
See PRM 3-197,3-143,3-252
"Wimp_GetPointerInfo",,block%
3block%!20=block%!12:
Destination window handle
1block%!24=block%!16:
Destination icon handle
Hblock%!28=block%!0:block%!32=block%!4:
x,y co-ords where drag ended
8block%!16=1:
Send DataSave message to external app.
9block%!12=0:
Your ref (0, since this is not a reply)
datasize%=End%-Start%
'block%!36=datasize%:block%!40=Type%
design%
dragbutt%>0
adjust_field(dragbutt%)
Filename$<>""
% $(block%+44)=
leaf(Filename$)
, !block%=64:
Length of message block
;
"Wimp_SendMessage",18,block%,block%!20,block%!24
ramptr%=Start%
"Wimp_CreateMenu",,-1
encrypt(S$,Z%)
I%,R%
(-12817)
I%=1
S$,I%,1)>"@"
R%=
(58)-1
R%=58-R%
1
S$,I%,1)=
S$,I%,1))-65+R%)
58+65)
dir(s$)
leaf$
leaf$=
leaf(s$)
=leafnamepath$
leaf(s$)
s2$=""
s$)<>"."
s$<>""
s2$=
s$)+s2$
s$=
leafnamepath$=
Message handling ----------------------------------------------------
not_acknowledged
block%!16
RAMTransmit failed
merging%
moan_err%,
msg("Err39")
DataLoad sent by Powerbase but unacknowledged, hence returned
At this point, the message ought to have been sent by us, so check it
Very bizarre situation if you get this error (!!)
block%!8<>my_ref%
moan_err%,"Reference fields mismatch (msglost/DataLoad)"
If transfer marked as temporary, delete scrap file
block%!36=-1
"OS_File",6,block%+44
moan_err%,
msg("Err39")
&80142:
moan_err%,
msg("Err90")
### Attempt to print directly when no driver installed ###
&4AF80:
block%!8=my_ref%
"Wimp_StartTask",Run_It$
### No browser loaded to fetch URL ###
message
task%,task$,filename$,wi%,ic%
2Atask%=block%!4:your_ref%=block%!8:wi%=block%!20:ic%=block%!24
block%!16
Access%
quit%=
check_record
quit%=
DataSave - request by external task to save to Powerbase
or to 'save' one Powerbase field into another in same database
(dragfield%>0
task%<>mytask%)
present%=7
datasize%=block%!36
block%!40
:
&fff,&ff9,&aff,&dfe:
;C block%!0=256:block%!12=your_ref%:block%!16=2:block%!36=-1
<* $(block%+44)="<Wimp$Scrap>"+
=B
"Wimp_SendMessage",17,block%,task%:
Send DataSaveAck
>
DataSaveAck - Powerbase wishes to save to external app.
DataSave has been sent & acknowledgement now received
B2 Type%=block%!40:filename$=
getstr(block%+44)
filename$<>""
E$
savefunc$="Save object":
FU
"OS_CLI","Copy "+$database%+"."+$Rf%(Fieldnumber%)+" "+filename$+" ~C~V"
GO
reformat%>0
filename$=$database%:
softerror(
leaf(filename$),200)
I"
dragfield%>0
(-1)
JM $savebuff%="{merge "":Powerbase GetField "+Tag$(dragfield%)+"""}"
KA Start%=savebuff%:End%=Start%+
($savebuff%):Type%=&fff
dragfield%=0
N,
save(filename$,Type%,Start%,End%)
OL
leaf(filename$)<>"Log"
write_log(-1,"File saved:",filename$)
P2 block%!0=256:block%!20=wi%:block%!24=ic%
Q9 block%!12=your_ref%:block%!16=3:
Send DataLoad
R2
"OS_File",5,filename$
,,,,block%!36
S5 block%!40=Type%:$(block%+44)=filename$+
T/
"Wimp_SendMessage",18,block%,task%
my_ref%=block%!8
V
"Wimp_CreateMenu",,-1
DataLoad - request from external app. for Powerbase to load file
Z+ f$=
getstr(block%+44):type%=block%!40
"TaskManager_TaskNameFromHandle",task%
task$
]@
task$=progname$
type%=&fff:
load_to_icon(f$,wi%,ic%)
^M
One data field dragged to another, not necessarily in same database
_&
pasting%:
from_clipboard(f$)
get_it_in(f$)
block%!8<>0
"OS_CLI","Remove <Wimp$Scrap>"
c> !block%=20:block%!12=your_ref%:block%!16=4:
Acknowledge
"Wimp_SendMessage",17,block%,task%
DataLoadAck - external app. acknowledges data sent by Powerbase
### DataOpen - response to file double click ###
block%!40
&7f1,&7f3,&7f4,&7f5:
present%=7
j4 !block%=20:block%!12=your_ref%:block%!16=4
k/
"Wimp_SendMessage",17,block%,task%
block%!20=-1
m(
get_it_in(
getstr(block%+44))
n
&2000:
kill%
present%=0
q2
### Is it a Powerbase application? ###
f$=
getstr(block%+44)
s2
"OS_File",5,f$+".Indices"
d%,,type%
tE
d%=2
"OS_CLI","Rename "+f$+".Indices "+f$+".Indexes"
u8
"OS_File",5,f$+".Indexes"
d%,,type%
v! type%=(type%>>8)
&fff
d%=2
x6 !block%=20:block%!12=your_ref%:block%!16=4
y1
"Wimp_SendMessage",17,block%,task%
z*
get_it_in(
getstr(block%+44))
|
RAMFetch - Ignore this message if not a simple memory-block save
savefunc$
"Save as text","Save text","Save sprite","Save draw","Save query","Save selection","Save table","Export selected","Clipboard":
ram_transmit
### Desktop boot file ###
"OS_GSTrans","Run <PBase$Dir>",block%+&100,&f00
,bootcmd$
#block%!20,bootcmd$
### Claim entity; an app has claimed input focus or clipboard ###
(block%!20)
%100
clip%=
### Data request; an application wants to paste from clipboard ###
(block%!36)
%100
c block%!12=your_ref%:block%!36=
(scratchpad$)+1:block%!40=&fff:$(block%+44)="Clipboard"+
9 block%!16=1:
"Wimp_SendMessage",18,block%,task%
my_ref%=block%!8
&502:
help_message(task%,your_ref%,block%!32,block%!36)
&400C0:
message_menu_select
&400C1:
### Mode change ###
getscreensize(ScreenWidth%,ScreenHeight%,Vpix%)
load_sprites
&400CC:
block%!20=mainW%
iconise%=
&400CF:
### Desktop font changed ###
Desktopfont%>0
Desktopfont%<>block%!20
Desktopfont%=block%!20:
softerror("",146)
ram_transmit
datasize%>block%!24
tosend%=block%!24
tosend%=datasize%
"Wimp_TransferBlock",mytask%,ramptr%,block%!4,block%!20,tosend%
block%!24=tosend%
datasize%-=tosend%
ramptr%+=tosend%
#block%!12=your_ref%:block%!16=7
"Wimp_SendMessage",18+(datasize%=0),block%,block%!4
my_ref%=block%!8
load_to_icon(f$,wi%,ic%)
L%,F,len%,F%,ok%,V%,b$,butt%,I%
ic%<0
dragfield%=0
buffer_length(wi%,ic%)
"OS_File",5,f$
,,,,len%
len%>255
wi%=mainW%
) F%=
get_field(ic%):V%=chartype%(F%)
ic%
2=0:ok%=0
V%=36
V%=39:
1 L%=
blob_path(
,$database%,REC%,F%,36,b$)
-
"OS_CLI","Copy "+f$+" "+b$+" ~C~V"
ok%=2
A
V%=39
show_text_block(F%,REC%):
redraw_icon(wi%,ic%)
vtype$(V%)="E":ok%=1
/
vtype$(V%)="L":ok%=1:ScrollChanged%=
= !block%=wi%:block%!4=ic%:
"Wimp_GetIconState",,block%
$ butt%=((block%!25)>>4)
%1111
butt%=14
butt%=15
ok%=1
I%=0
Scrollnum%-1
$
wi%=scrollerW%(I%)
ok%=3
I%
ok%
softerror("",213)
1,3:
"OS_File",255,f$,savebuff%
savebuff%?len%=13
text(wi%,ic%)=
$savebuff%,L%)
set_caret(0,wi%,ic%)
redraw_icon(wi%,ic%)
ok%=3
ScrollChanged%=
message_menu_select
P%,Q%,I%
keyfunc$=""
5handle%=block%!20:xmin%=block%!24:ymax%=block%!28
"Wimp_DecodeMenu",,menuhandle%,block%+32,choices%
text(saveW%,4)="":
shade(saveW%,4,
deselect(saveW%,4)
I%=1
Q%=
$choices%,".",P%+1)
& choice$(I%)=
$choices%,P%,Q%-P%)
P%=Q%+1
menuhandle%
iconbarM%:
choice$(1)
"New database":
$SaveName%="!DataBase"
1 $SaveSprite%="snew_appl;Pptr_hand,4,0;R2"
savefunc$=choice$(1)
mainM%:
choice$(2)
"Save as list":
3 $SaveName%=$database%+".PrintJobs.TextList"
1 $SaveSprite%="sfile_fff;Pptr_hand,4,0;R2"
savefunc$=choice$(2)
"Save as CSV":
F $SaveName%=$database%+".PrintJobs."+
set_up_save_box(1)+"file"
- savefunc$=choice$(2):writescroller%=
choice$(1)
"Print":
choice$(2)
"Save query":
1 $SaveName%=$database%+".PrintRes.Query"
3 $SaveSprite%="sfile_7f4;Pptr_hand,4,0;R2"
* $
text(saveW%,4)="Default query"
6
shade(saveW%,4,
deselect(saveW%,4)
"Save selection":
5 $SaveName%=$database%+".PrintRes.Selection"
3 $SaveSprite%="sfile_7f3;Pptr_hand,4,0;R2"
. $
text(saveW%,4)="Default selection"
0
shade(saveW%,4,
deselect(saveW%,4)
"Display selection":
J fieldsM%=
field_menu(items%,2+(printorder$="")):handle%=fieldsM%
/ item%=printM%+28+9*24:item%!4=handle%
savefunc$=choice$(2)
4
"Validation":
make_table_menu(TabsLoaded$)
"
"Index":
make_index_menu
"Copy as":
$SaveName%="!NewName"
1 $SaveSprite%="snew_appl;Pptr_hand,4,0;R2"
savefunc$=choice$(1)
"Export selected":
3 $SaveName%=$database%+".PrintJobs.Selected"
1 $SaveSprite%="sfile_fff;Pptr_hand,4,0;R2"
savefunc$=choice$(1)
designM%:
choice$(1)
"Save form file":
% $SaveName%=$database%+".Form"
1 $SaveSprite%="sfile_7f2;Pptr_hand,4,0;R2"
savefunc$=choice$(1)
tableM%:
choice$(1)
"Save":
4 $SaveName%=$database%+".ValTables."+$tableM%
1 $SaveSprite%="sfile_7f1;Pptr_hand,4,0;R2"
savefunc$="Save table"
"Save as CSV":
H $SaveName%=$database%+".PrintJobs."+
set_up_save_box(1)+$tableM%
3 savefunc$="Save table as CSV":writetable%=
listM%:
choice$(1)
"Save as text":
$SaveName%=TextName$
1 $SaveSprite%="sfile_fff;Pptr_hand,4,0;R2"
savefunc$=choice$(1)
"Wimp_CreateSubMenu",,handle%,xmin%,ymax%
help_message(task%,your_ref%,wi%,ic%)
T%,C%
T%=0
LastTable%
wi%=tableW%(T%)
Tablenumber%=T%
&!Scroller%=
scroller_num2(wi%)
wi%
help("HelpPbase")
bannerW%:
Do nothing
listW%:
help("HelpList")
tableW%(Tablenumber%):
help("HelpTable")
scrollerW%(Scroller%):
help("HelpScroller")
mainW%:
/-
ic%<0:
present%=7
help("main?")
(ic%
2)=1:
field%=(ic%+1)
C%=chartype%(field%)
hide%?field%=0
s$="main"+
5G
phone(field%)
s$+=","+
msg("phone,"+
(DialDelay%
100))
6*
C%=5
s$+="_"+
(len%(field%))
7;
mandatory%?field%=1
s$+=","+
msg("mandatory")
82
C%>67
C%<79
s$+=","+
msg("update")
9.
C%>8
C%<32
s$="keypad"+
(C%-9)
:6
present%=7
help(s$)
help("maindrag")
;
pselectW%:
help("Pselect")
infoW%:
help("info"+
(ic%))
miscW%:
help("misc"+
(ic%))
relateW%:
help("relate"+
(ic%))
accessW%:
help("access"+
(ic%))
keypadW%:
help("keypad"+
(ic%))
searchW%:
help("search"+
(ic%))
filterW%:
help("filter"+
(ic%))
queryW%:
help("query"+
(ic%))
moveW%:
help("move"+
(ic%))
calcW%:
help("calc"+
(ic%))
sizeW%:
help("size"+
(ic%))
matchW%:
help("match"+
(ic%))
tabcreateW%:
help("tabcreate"+
(ic%))
changeW%:
help("change"+
(ic%))
passW%:
help("passwd"+
(ic%))
aclW%:
help("acl"+
(ic%))
saveW%:
help("save"+
(ic%))
savesubW%:
help("savesub"+
(ic%))
printW%:
help("print"+
(ic%))
printerW%:
help("printer"+
(ic%))
createW%:
help("create"+
(ic%))
scrollW%:
help("scroll")
prefsW%:
help("prefs"+
(ic%))
csvW%:
help("csv"+
(ic%))
fkeyW%:
help("fkey"+
(ic%))
helpW%:
help("help"+
(ic%))
keyW%:
help("key"+
(ic%))
colW%:
help("col"+
(ic%))
linkW%:
help("link"+
(ic%))
reformW%:
help("reform"+
(ic%))
mergebaseW%:
help("mergebase"+
(ic%))
mergeW%:
help("merge"+
(ic%))
gridW%:
help("grid"+
(ic%))
markW%:
help("mark"+
(ic%))
extracalcW%:
help("extracalcs"+
(ic%))
mergecomW%:
help("mergecom"+
(ic%))
menu_help
menu_help
ptr%,ch$,choice$
"Wimp_GetMenuState",,menhelpblock%
ptr%=0
menhelpblock%!ptr%<>-1
ch$=
(menhelpblock%!ptr%)
(ch$)=2
ch$+="_"
choice$+=ch$
ptr%+=4
menuhandle%
iconbarM%:
help("iconbar"+choice$)
mainM%:
help("mainmen"+choice$)
designM%:
help("design"+choice$)
keystrokeM%:
help("keystroke"+choice$)
mergecomM%:
help("mergemen"+choice$)
help(token$)
!block%=256
block%!4=task%
block%!12=your_ref%
block%!16=&503
$(block%+20)=
msg(token$)
"Wimp_SendMessage",17,block%,block%!4
File saving --------------------------------------------------------
export_selected(Form$)
I%,F%,P%,F$
GSHsaveptr%=
extend_named_sliding_block(saveanchor%,Length%+fields%)
P%=SHsaveptr%
I%=1
(Form$)-1
F%=
fnum(
Form$,I%,2))
F$=$Rf%(F%)+
$P%=F$:P%+=
(Start%=SHsaveptr%:End%=P%:Type%=&fff
scrap_block(saveanchor%)
save_all_tables
name$
"Hourglass_On"
Tablenumber%=0
Tablenumber%<=LastTable%
name$=table$(Tablenumber%)
name$,1)<>"*"
) f$=$database%+".ValTables."+name$
c t$=
table_info(Tablenumber%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)
E Start%=SHtabptr%(Tablenumber%):End%=Start%+offset%+Rows%*Rec%
"
save(f$,&7f1,Start%,End%)
Tablenumber%+=1
"Hourglass_Percentage",Tablenumber%*100
(LastTable%+1)
"Hourglass_Off"
save(f$,ft%,start%,end%)
leaf$,L$,R$,S$,swap%
leaf$=
leaf(f$)
f$,9)="Powerbase"
softerror("",129):
writingtext%
ft%
savefunc$="Copy as"
$
leaf($database%))=0
8
"OS_CLI","Copy "+$database%+" "+f$+" ~C~VR"
-
copy_database_spritefile(f$,leaf$)
softerror("",183)
"OS_File",8,f$
$
"OS_File",8,f$+".Indexes"
&
"OS_File",8,f$+".ValTables"
"
"OS_File",8,f$+".Menus"
%
"OS_File",8,f$+".PrintRes"
&
"OS_File",8,f$+".PrintJobs"
&
"OS_File",8,f$+".UserFuncs"
K
"OS_CLI","Copy <PBase$Dir>.Resources.Temp.!Run "+f$+".!Run ~C~V"
F
"OS_CLI","Copy <PBase$Dir>.Resources.Info "+f$+".Data ~C~V"
+
copy_database_spritefile(f$,leaf$)
reformat%>0:
$Reformatted%=f$
reformat%
D
"OS_CLI","Copy "+$database%+".Form "+f$+".Form ~C~VF"
get_it_in(f$)
open_window(mainW%)
complete(6)
;
selected(reformW%,11)
softerror("",160)
>
"OS_CLI","Copy "+$Newform%+" "+f$+".Form ~C~VF"
do_reformat
D
mergefiles%:
merge_files($
text(mergebaseW%,3),f$,file%)
&
export%:
export_subset(f$)
csvconv%:
SHformptr%=0
H SHformptr%=
extend_named_sliding_block(formanchor%,SHclaim%)
Fptr%=SHformptr%
$ fields%=0:Fieldnumber%=0
$ fields%=
get_form(Fptr%)
lit(iconbarM%,1,
get_it_in(f$)
open_window(mainW%)
SHformptr%=0
H SHformptr%=
extend_named_sliding_block(formanchor%,SHclaim%)
Fptr%=SHformptr%
$ fields%=0:Fieldnumber%=0
close_window(saveW%)
&7f2:
save_form(f$)
&7f5:
save_options(printW%,printerW%,f$)
&dfe:
6
writetable%:
table_to_csv(Tablenumber%,f$)
7
writescroller%:
scroller_to_csv(Scroller%,f$)
9
(-1)
write_csv(f$,REC%)
write_csv(f$,-1)
$
leaf$="Log"
leaf$="Acl":
- L$="Set "+leaf$+"$Dir "+leafnamepath$
3
leaf$="Log"
close_log("<Log$Dir>.Log")
G
leaf$="Acl"
acl%=
"OS_CLI","Rename <Acl$Dir>.Acl "+f$
"OS_CLI",L$
E
"OS_CLI","Rename "+$database%+".!Run "+$database%+".!Temp"
9 F=
($database%+".!Temp"):F1=
($database%+".!Run")
S$=
S$,7)="Set Log":
5
leaf$="Log"
#F1,L$:swap%=
#F1,S$
S$,7)="Set Acl":
5
leaf$="Acl"
#F1,L$:swap%=
#F1,S$
S$,3)="Run":R$=S$
#F1,S$
swap%
#F1,L$
#F1,R$
&
close_file(F):
close_file(F1)
/
"OS_File",18,$database%+".!Run",&feb
1
"OS_CLI","Remove "+$database%+".!Temp"
G
leaf$="Log"
set_icon(passW%,16,
mouse(0,0,4,passW%,4)
savetofile%:
texthandle%=
"OS_File",18,f$,Type%
I writingtext%=
Make sure we can't re-enter this PROC until done
"
do_it(Search$,displayed%)
writingtext%=
+
"OS_File",10,f$,ft%,,start%,end%
!
scrap_block(saveanchor%)
ramwarn%=
getstr(p%)
?p%>31
p$+=
(?p%)
p%+=1
Validation tables ----------------------------------------------------
tabcreate_click(wi%,ic%,b%)
I%,L%,head$,tablen%,width$,max%,row%,y%,headlen%,col%,z%,lim%
"Hourglass_Smash":
wimp_error(
(b%
%111)=4
z%=1
z%=-1
%111
1,4:
ic%
row%=
($tabcol%)
row%>MaxCols%
$&
softerror(
(MaxCols%+1),42)
row%=MaxCols%
$tabcol%=
(row%)
redraw_icon(wi%,8)
(
)%
set_caret(0,scrollW%,row%*2)
*)
row%<3
y%=0
y%=-(row%-2)*44
+9 !block%=scrollW%:
"Wimp_GetWindowState",,block%
,1 block%!24=y%:
"Wimp_OpenWindow",,block%
13,14:
.@ col%=
get_icon_cols(wi%,ic%):fg%=col%
16:bg%=col%
/I
selected(wi%,11)
fg%=(fg%+z%+16)
bg%=(bg%+z%+16)
0*
set_icon_cols(wi%,ic%,fg%+bg%*16)
2J start$="new"+
get_icon_cols(wi%,13)*256+
get_icon_cols(wi%,14))
3C name$=$
text(wi%,0):
name$=""
moan_err%,
msg("Err103")
4E Rows%=
text(wi%,1)):
Rows%=0
moan_err%,
msg("Err104")
LastTable%+=1
Tablenumber%=LastTable%
70 table$(Tablenumber%)=
name$,NameLength%)
tablen%=
(start$)+1
tablen%+=
(Rows%))+1
"Hourglass_On"
TabFields%=0
<,
text(scrollW%,TabFields%*2)<>""
=. width$=$
text(scrollW%,TabFields%*2)
tablen%+=
(width$)+1
?, tabfieldlen%(TabFields%)=
(width$)
@* Rec%+=tabfieldlen%(TabFields%)+1
A/ head$=$
text(scrollW%,TabFields%*2+1)
BW
(head$)>tabfieldlen%(TabFields%)
LastTable%-=1:
moan_err%,
msg("Err38")
headlen%+=
(head$)+1
TabFields%+=1
E
TabFields%-=1
G3
TabFields%<0
moan_err%,
msg("Err112")
H9 tablen%+=(
(TabFields%))+1+headlen%+Rows%*Rec%)
IM SHtabptr%(Tablenumber%)=
claim_page(tabanchor%(Tablenumber%),tablen%)
J) SHtabptr%=SHtabptr%(Tablenumber%)
K4 $SHtabptr%=start$:SHtabptr%+=
($SHtabptr%)+1
L6 $SHtabptr%=
(Rows%):SHtabptr%+=
($SHtabptr%)+1
M; $SHtabptr%=
(TabFields%):SHtabptr%+=
($SHtabptr%)+1
I%=0
TabFields%
OC $SHtabptr%=
(tabfieldlen%(I%)):SHtabptr%+=
($SHtabptr%)+1
I%=0
TabFields%
RG $SHtabptr%=$
text(scrollW%,I%*2+1):SHtabptr%+=
($SHtabptr%)+1
row%=1
Rows%
I%=0
TabFields%
V7 $SHtabptr%="":SHtabptr%+=tabfieldlen%(I%)+1
row%
"Hourglass_Off"
Z%
show_table(Tablenumber%,0,0)
["
text(wi%,2)="Modify"
\:
write_back_to_table(OldTable%,Tablenumber%,wi%)
]' table$(OldTable%)=
"*"+name$)
^ P%=
TabsLoaded$,name$)
_5
TabsLoaded$,P%,
(name$))=table$(OldTable%)
`'
close_it(tableW%(OldTable%))
a
TabsLoaded$+=","+name$
c%
make_table_menu(TabsLoaded$)
d1
close_it(wi%):
restore_caret(starthere%)
asterisk(
fK
close_it(wi%):
restore_caret(returnto%):$
text(wi%,2)="Create"
renew_tables
display(key%,addr)
modify_table(T%,wi%)
I%,Rows%,Rec%,L%,TabFields%,head$,cols%
oUt$=
table_info(T%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)
text(wi%,2)="Modify"
text(wi%,0)=table$(T%)
text(wi%,1)=
(Rows%)
$tabcol%="0"
I%=0
MaxCols%*2+1
text(scrollW%,I%)=""
I%=0
TabFields%
x/ $
text(scrollW%,I%*2)=
(tabfieldlen%(I%))
yI $
text(scrollW%,I%*2+1)=$
text(tableW%(T%),Rows%*(TabFields%+1)+I%)
colours$=""
colours$="2807"
cols%=
("&"+colours$)
set_icon_cols(wi%,13,cols%
256)
set_icon_cols(wi%,14,cols%
256)
OldTable%=T%
open_window(wi%):
set_caret(0,wi%,0)
redraw(wi%):
redraw(scrollW%)
write_back_to_table(old%,new%,wi%)
row%,column%,P%,N%,I%,ic%
table_info(old%,oldRows%,oldTabFields%,Rec%,tabfieldlen%(),oldoffset%,oldheading%,colours$)
P%=oldheading%
tabhead$()=""
I%=0
oldTabFields%
% tabhead$(I%,0)=$P%:P%+=
($P%)+1
I%=0
TabFields%
, tabhead$(I%,1)=$
text(scrollW%,2*I%+1)
oldRows%<=Rows%
N%=oldRows%-1
N%=Rows%-1
"Hourglass_On"
row%=0
- P%=SHtabptr%(old%)+oldoffset%+row%*Rec%
column%=0
oldTabFields%
I%=-1
I%+=1
<
tabhead$(I%,1)=tabhead$(column%,0)
I%>TabFields%
I%<=TabFields%
$ ic%=row%*(TabFields%+1)+I%
K $
text(tableW%(new%),ic%)=
buffer_length(tableW%(new%),ic%))
% P%+=tabfieldlen%(column%)+1
column%
row%
"Hourglass_Off"
text(wi%,2)="Create"
redraw(tableW%(new%))
clear_table(T%)
confirm(
msg("Err47"))=
R%,F%,ind%,Rows%,TabFields%,start%,Rec%
table_info(T%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)
%start%=SHtabptr%(T%)+offset%-Rec%
R%=1
Rows%
ind%=start%+R%*Rec%
F%=0
TabFields%
) $ind%="":ind%+=tabfieldlen%(F%)+1
redraw(tableW%(T%))
asterisk(
show_table(T%,x%,y%)
ind%,start%,dflags%,hflags%,c%,I%,pos%,p$,t$,B%,tablefield%,offset%,heading%,colours$,width%,OK%
table_info(T%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)
;NewTab%=(t$="
"):extra%=-NewTab%*(Rows%*(TabFields%+1))
T%<0
/tablen%=
sliding_block_size(tabanchor%(T%))
SHundoptr%(T%)<=0
SHundoptr%(T%)=
extend_named_sliding_block(undoanchor%(T%),tablen%)
"Wimp_TransferBlock",mytask%,SHtabptr%(T%),mytask%,SHundoptr%(T%),tablen%
tableW%(T%)>0
text(tableW%(T%),0)
%
SHtabptr%(T%)+offset%:OK%=
B
:!block%=tableW%(T%):
"Wimp_DeleteWindow",,block%:OK%=
OK%
open_window(tableW%(T%))
name$=table$(T%)
$Tablename%=name$
$tableM%=name$
ind%=SHtabptr%(T%)+offset%
"Wimp_OpenTemplate",,"<Pbase$Dir>.Resources.Templates"
B%=buff%
"Wimp_LoadTemplate",,block%,buff%,endbuff%,-1,"table",0
,,buff%
NewTab%
(name$)+1
(t$)+1
buff%+=L%:block%!80=L%
"Wimp_CloseTemplate"
% block%!28=block%!28
&AFFFFFFF
1
(Rec%+TabFields%+9)*16<1136
Rows%<16:
C
(Rec%+TabFields%+9)*16<1136:block%!28=block%!28
(1<<28)
0
Rows%<16:block%!28=block%!28
(1<<30)
1
:block%!28=block%!28
((1<<28)+(1<<30))
"Wimp_CreateWindow",,block%
tableW%(T%)
R TabTitle%(T%)=block%!72:
NewTab%
$TabTitle%(T%)=name$
$TabTitle%(T%)=t$
"Hourglass_On"
colours$=""
colours$="2807"
cols%=
("&"+colours$)
+ hflags%=&0000A535+((cols%
256)<<24)
+ dflags%=&0000A535+((cols%
256)<<24)
row%=1
Rows%
pos%=72
I%=0
TabFields%
8 width%=
guess_width(tabfieldlen%(I%),2,width%)
z R%=
create_icon(0,tableW%(T%),pos%,-row%*44-4+44*NewTab%,width%+2,48,dflags%,"",ind%,writep%,tabfieldlen%(I%)+1)
pos%+=width%
" ind%+=tabfieldlen%(I%)+1
2
"Hourglass_Percentage",row%*100
Rows%
row%
NewTab%
pos%=72
I%=0
TabFields%
8 width%=
guess_width(tabfieldlen%(I%),2,width%)
g R%=
create_icon(0,tableW%(T%),pos%,-48,width%+2,48,hflags%,"",heading%,-1,tabfieldlen%(I%)+1)
pos%+=width%
" heading%+=
($heading%)+1
"Hourglass_Off"
p$=printrel$(T%)
p$<>""
I%=1
(p$)
" tablefield%=
p$,I%,3))
1
select(tableW%(T%),tablefield%+extra%)
, width%=
guess_width(Rec%,2,width%)+112
/ !block%=0:block%!4=-Rows%*44-4+44*NewTab%
! block%!8=width%:block%!12=0
"Wimp_SetExtent",tableW%(T%),block%
!block%=tableW%(T%)
"Wimp_GetWindowState",,block%
x%=0
x%=(ScreenWidth%-width%)
block%!4=x%
block%!12=block%!4+width%
Rows%<20
2
y%=0
y%=ScreenHeight%
2-(Rows%*18+2)
block%!8=y%
0 block%!16=block%!8+Rows%*44+4-44*NewTab%
)
y%=0
y%=ScreenHeight%
2-362
block%!8=y%
- block%!16=block%!8+44*20+4-44*NewTab%
"Wimp_OpenWindow",,block%
redraw(tableW%(T%))
Access%
set_caret(0,tableW%(T%),0)
renew_tables
T%=0
MaxTabs%
# SHtabptr%(T%)=!tabanchor%(T%)
% SHundoptr%(T%)=!undoanchor%(T%)
tableW%(T%)>0
!block%=tableW%(T%)
(
"Wimp_GetWindowState",,block%
G
((block%!32)
(1<<16))>0
show_table(T%,block%!4,block%!8)
restore_table(T%)
/tablen%=
sliding_block_size(tabanchor%(T%))
"Wimp_TransferBlock",mytask%,SHundoptr%(T%),mytask%,SHtabptr%(T%),tablen%
redraw(tableW%(T%))
restore_tabfield
source%,dest%
"Wimp_GetCaretPosition",,block%:wi%=!block%:ic%=block%!4
wi%=tableW%(Tablenumber%)
&, dest%=
text(tableW%(Tablenumber%),ic%)
'D source%=SHundoptr%(Tablenumber%)+dest%-SHtabptr%(Tablenumber%)
$dest%=$source%
redraw_icon(tableW%(Tablenumber%),ic%)
sort_table(T%,field%)
tablen%,ind%,Rec%,Rows%,row%,TabFields%,pos%,dest%
/Ytitle$=
table_info(T%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)
0,pos%=
table_field(field%,tabfieldlen%())
1(ind%=SHtabptr%(T%)+offset%-Rec%+pos%
row%=0
Rows%-1
ind%+=Rec%
block%!(row%*4)=ind%
$ind%=""
$ind%="~"
row%
"OS_HeapSort",Rows%,block%,4
8?SHsort%=
extend_named_sliding_block(sortanchor%,Rows%*Rec%)
dest%=SHsort%-Rec%
row%=0
Rows%-1
;& ind%=block%!(row%*4):dest%+=Rec%
$ind%="~"
$ind%=""
"Wimp_TransferBlock",mytask%,ind%-pos%,mytask%,dest%,Rec%
row%
"Wimp_TransferBlock",mytask%,SHsort%,mytask%,SHtabptr%(T%)+offset%,Rows%*Rec%
scrap_block(sortanchor%)
redraw(tableW%(T%))
print_table(T%)
printing%
indexing%
start%,ptr%,Line$,title$,rowsused%,Heading$,h$,column%
print_init("W")
HZTextName$=$database%+".PrintJobs."+
"Tab"+table$(T%),NameLength%):$SaveName%=TextName$
IYtitle$=
table_info(T%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)
format$="vtab"
spacer$,"|")>0
spacer$="|"
NewTab%=(title$="
M'LenLine%=Lmargin%+Rec%+TabFields%-1
LenLine%<Lmargin%+26
LenLine%=Lmargin%+26
O@maxhead%=0:hspace%=164:fspace%=126:PrintFields%=TabFields%+1
column%=0
PrintFields%
Q= Tab%(column%+2)=Tab%(column%+1)+tabfieldlen%(column%)+1
column%
end_line
send_title("Validation table")
send_title("Name: "+table$(T%))
send_title(
NewTab%
column%=0
TabFields%
Y; h$=$
text(tableW%(T%),Rows%*(TabFields%+1)+column%)
Z: Heading$+=h$+
tabfieldlen%(column%)-
(h$)," ")+" "
column%
send_title(
Heading$))
send_title(
title$,Rec%-1))
"Hourglass_On"
I%=1
Rows%
f' start%=SHtabptr%(T%)+offset%-Rec%
Line$=""
ptr%=start%+I%*Rec%
J%=0
TabFields%
jD
$ptr%<>""
Line$+=$ptr%+
tabfieldlen%(J%)-
($ptr%)+1," ")
k ptr%+=tabfieldlen%(J%)+1
Line$<>""
rowsused%+=1
o'
store_string(Line$,Lmargin%,
"Hourglass_Percentage",I%*100
Rows%
"Hourglass_Off"
send_title(
(Rows%)+" rows")
send_title(
(rowsused%)+" used")
screen_list
write_log(-1,"Table printed: "+table$(T%),"")
table_number(N$)
T%,P%
N$=""
T%=-1
T%+=1
table$(T%)=N$
T%>LastTable%
T%>LastTable%
table_info(table%,
rows%,
columns%,
recordlength%,colwidth%(),
offset%,
heading%,
colours$)
P%,Q%,I%,new%,S$
P%=SHtabptr%(table%):Q%=P%
S$=$P%
S$,3)="new"
new%=
:colours$=
S$,4):P%+=
($P%)+1
rows%=
($P%):P%+=
($P%)+1
columns%=
($P%):P%+=
($P%)+1
recordlength%=0
I%=0
columns%
' colwidth%(I%)=
($P%):P%+=
($P%)+1
$ recordlength%+=colwidth%(I%)+1
heading%=P%
new%
I%=0
columns%
P%+=
($P%)+1
offset%=P%-Q%
P%+=
($P%)+1:offset%=160
new%
=$heading%
table_field(F%,L%())
I%,P%
I%<F%
P%+=L%(I%)+1
I%+=1
trailing_number(
exact%)
S$)="~"
exact%=
exact%=
S$<>""
S$))<58
N$=
S$)+N$
S$=
N$=""
leading_number(
column%,
S$<>""
S$,2,1)="#"
column%=
S$=
S$,3)
column%=0
(S$)<58
N$=N$+
S$,1)
S$=
S$,2)
N$=""
load_table(f$,show%)
pos%,name$,d%,L%
f$)="!"
"OS_CLI","Rename "+f$+" "+
f$)+"+"
f$=
f$)+"+"
name$=
leaf(f$):L%=
(name$)
TabsLoaded$,name$,7)=0
"OS_File",5,f$
d%,,,,tablen%
LastTable%=MaxTabs%-1
show%
X
softerror(
(MaxTabs%+1)+",validation tables,"+
(MaxTabs%)+",Tabs",32):show%=
:
extratabs$,name$)=0
extratabs$+=name$+"\"
LastTable%+=1
6
LastTable%=MaxTabs%-1
lit(validateM%,0,
Y SHtabptr%(LastTable%)=
extend_named_sliding_block(tabanchor%(LastTable%),tablen%)
1
"OS_File",255,f$,SHtabptr%(LastTable%)
table$(LastTable%)=name$
Tablenumber%=LastTable%
TabsLoaded$+=","+name$
Tablenumber%=
table_number(name$)
show%
show_table(Tablenumber%,0,0)
make_table_menu(menu$)
ptr%,I%
ptr%=
clear_dynamic_menus
LastTable%>=0
, valtablesM%=
create_menu(ptr%,menu$)
@ ptr%=validateM%+52:ptr%!4=valtablesM%:
lit(validateM%,1,
lit(validateM%,1,
link_to_table(wi%,ic%,b%)
icon%
b%=(b%
%111)
make_table_menu(TabsLoaded$)
2,4:
ic%=13
8
tick_one(valtablesM%,0,LastTable%,Tablenumber%)
.
show_pop_up_menu(valtablesM%,wi%,ic%)
%111
1,4:
b%=4
z%=1
z%=-1
ic%
tcycle(-z%)
tcycle(+z%)
!
fcycle(z%,fieldnum%)
"
fcycle(-z%,fieldnum%)
$
fcycle(z%,substitute%)
%
fcycle(-z%,substitute%)
icon%=10
2
shade(linkW%,icon%,
selected(linkW%,9))
icon%
$
### Default action ###
" icon%=field%(Fieldnumber%)
1
selected(linkW%,4)
$Tablename%<>""
4 link$(Fieldnumber%)=$Tablename%+$fieldnum%
=
selected(linkW%,15)
link$(Fieldnumber%)+="~"
V
selected(linkW%,9)
link$(Fieldnumber%)=$substitute%+link$(Fieldnumber%)
&
chartype%(Fieldnumber%)
64,65,66,67:
B link$(Fieldnumber%)=
(Scrcol%)+"#"+link$(Fieldnumber%)
;
colour_scroller(Fieldnumber%,Scrcol%,fcol%(8))
3
set_icon_cols(mainW%,icon%,fcol%(8))
? link$(Fieldnumber%)="":
set_icon_cols(mainW%,icon%,7)
:
colour_scroller(Fieldnumber%,Scrcol%,fcol%(10))
$ K%=
is_a_key(Fieldnumber%)
key%:
colour(K%,1)
colour(K%,2)
link$(0)="LOADED"
asterisk(
&
b%=4
close_window(linkW%)
"
close_window(linkW%)
tcycle(z%)
LastTable%=-1
Tablenumber%+=z%
Tablenumber%>LastTable%
Tablenumber%=0
Tablenumber%<0
Tablenumber%=LastTable%
$$Tablename%=table$(Tablenumber%)
redraw_icon(linkW%,0)
fcycle(z%,column%)
$_T$=
table_info(Tablenumber%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)
field%=
($column%)
field%+=z%
field%>TabFields%
field%=0
field%<0
field%=TabFields%
$column%=
(field%)
redraw_icon(linkW%,2)
redraw_icon(linkW%,10)
link_status
name$,field$,ic%,subst$,exact%,scrcol%
name$=link$(Fieldnumber%)
1,field$=
trailing_number(name$,exact%))
set_icon(linkW%,15,exact%)
3,subst$=
leading_number(scrcol%,name$))
subst$="-1"
subst$="0"
(name$<>""
TabsLoaded$,name$)>0)
6= $Tablename%=name$:$fieldnum%=field$:$substitute%=subst$
7' Tablenumber%=
table_number(name$)
set_icon(linkW%,4,(scrcol%=0
scrcol%=Scrcol%))
Tablenumber%=0
;& $Tablename%=table$(Tablenumber%)
deselect(linkW%,4):$fieldnum%="0"
set_icon(linkW%,9,subst$<>"0")
ic%=10
shade(linkW%,ic%,
selected(linkW%,9))
redraw_icon(linkW%,0):
redraw_icon(linkW%,2)
save_links
link$(0)="LOADED"
($database%+".Link")
F%=1
fields%
#F,link$(F%)
close_file(F)
End of Validation table routines ------------------------------------
changes(key%,field%,Old$,New$,confirm%)
M$,K%,P%,index%,zero%,target$,log$,numeric%,fi$
fi$=" "
I%=0
selected(queryW%,I%+6)
fi$+=
(I%)+"\"
fi$,"\")>0
fi$="s"+fi$
Z"target$=$Query%:Search$=
parse
[%target$=
replace(target$,",","\")
New$=""
n$="<null>"
n$=New$
is_a_key(field%)
softerror("",144)
key%:
softerror("",12)
K%>0
msg("Err189")
M$=""
Old$<>""
o$=" "+
msg("Err184")+Old$
o$=""
target$=""
target$=" "+
msg("Err190,"+fi$)
target$=" "+
msg("Err191,"+target$+","+fi$)
chartype%(field%)
fN
41,42,43,61,62:Old$=
pos_neg(field%,Old$):New$=
pos_neg(field%,New$)
gZ
New$<>""
"+-*/",
New$,1))>0
New$,2))>0
n$=Tag$(field%)+n$:numeric%=
i' target$=
replace(target$,",","\")
j> log$=
msg("Err192,"+Tag$(field%)+","+n$+o$+target$+". ")
target$=log$+M$
confirm%=
confirm(target$)=
m) subtotal%=
count_recs(key%,zero%)
n. dbasehandle%=
($database%+".Database")
o3
scan_marked_subfiles("P%<>top",key%,5,1,
p!
close_file(dbasehandle%)
$Date%(file%)=
today
date%?file%=1
display(key%,addr)
t,
K%>0
remove_index(Index$(K%),
write_log(-1,log$,"")
asterisk(
is_a_key(F%)
key%,flag%,J%
flag%=-1
J%=0
&
KF%(key%,J%)=F%
flag%=key%
key%+=1
flag%>=0
key%>Keys%
=flag%
read(display%,N%,K%,R%,f$)
I%,key%,dbasehandle%,V%,P%,C%,d%,path$
"dbasehandle%=
(f$+".Database")
F$()=field$()
%$Rf%(0)="":field$(0)="":key$()=""
#dbasehandle%=
(R%)*Length%
I%=1
zerolen%?I%=0
field$(I%)=
#dbasehandle%
field$(I%)=""
C%=chartype%(I%)
"
21,27,28,32,34,40,45,59:
M
$Rf%(I%) holds key legend or other important data. Don't overwrite!
:$Rf%(I%)=field$(I%)
35,44:
WithLeaf%
4 $
text(mainW%,field%(I%))=
leaf(link$(I%))
(
text(mainW%,field%(I%))=""
36,37,38:
display%
*
set_blob_sprite(R%,I%,C%,path$)
)
displayit%?I%=1
design%
%
"OS_File",5,path$
3
d%>0
"OS_CLI","Filer_Run "+path$
1
display%
show_text_block(I%,R%)
.
display%
show_picture(I%,R%)
41,42,43:
display%
V
field$(I%)=" "
select(mainW%,field%(I%))
deselect(mainW%,field%(I%))
61,62:
9 V%=
val(mainW%,field%(I%)):P%=
$V%,";S"):V%+=P%+1
field$(I%)
(0):$V%="no"
" ":$V%="yes"
4
C%=61
$V%="null"
$V%="dontcare"
(
R%=RA%
$Rf%(I%)=
(REC%)
9
R%=RA%
split_link(I%,R$,V$):$Rf%(I%)=R$
'
R%=RA%
$Rf%(I%)=
(
R%=RA%
$Rf%(I%)=
$,15)
1
R%=RA%
$Rf%(I%)=
convert_date(2)
1
R%=RA%
$Rf%(I%)=
convert_date(4)
#
R%=RA%
$Rf%(I%)=
'
R%=RA%
$Rf%(I%)=
)
R%=RA%
$Rf%(I%)=
$,5,2)
)
R%=RA%
$Rf%(I%)=
$,8,3)
J
R%=RA%
$,8,3):P%=
Months$,M$):$Rf%(I%)=
((P%+2)
F
R%=RA%
$,3):P%=
Days$,D$):$Rf%(I%)=
((P%+2)
*
R%=RA%
$Rf%(I%)=
$,12,4)
display%
. f$=
filename($Rf%(I%),"PrintRes",-1)
& Z%=
set_remote_sprite(I%,f$)
L
Z%>0
displayit%?I%=1
design%
"OS_CLI","Filer_Run "+f$
0
64,65,66,67:
get_scroller(R%,I%,C%-63)
:
68,69,70,71,72,73,74,75,76,77,78:
set_now(C%,I%)
key%=0
Keys%
key$(key%)=
key(key%)
key%
close_file(dbasehandle%)
cfield$()=field$()
special%(1)
(libfunc$+"_function(1)")
set_now(C%,I%)
P%,D$,M$
68:$Rf%(I%)=
69:$Rf%(I%)=
$,15)
70:$Rf%(I%)=
convert_date(2)
71:$Rf%(I%)=
convert_date(4)
72:$Rf%(I%)=
73:$Rf%(I%)=
74:D$=
$,3):P%=
Days$,D$):$Rf%(I%)=
((P%+2)
75:$Rf%(I%)=
$,5,2)
76:$Rf%(I%)=
$,8,3)
77:M$=
$,8,3):P%=
Months$,M$):$Rf%(I%)=
((P%+2)
78:$Rf%(I%)=
$,12,4)
update_calcs(N%)
design%
N%>0
$Rf%(N%)=cfield$(N%)
I%,C%,L%,F,F$,Form$,S$,SF$,changed%,c%
GForm$=update$(N%):
List of fields affected by a change in field N%
Form$=0
calc_error(F$,F%,visible$,real$):=
I%=1
(Form$)-1
F%=
fnum(
Form$,I%,2))
F%<>N%
&
split_link(F%,real$,visible$)
chartype%(F%)
E
6:F=
(real$):F$=
fix%(F%)<>0
fix_point(F$,F%)
L
7:F$=
(real$):
N%=0
expand(F$,link$(F%),L%,SF$,c%):F$=SF$
(F$)<=len%(F%)
* $Rf%(F%)=F$:cfield$(N%)=$Rf%(N%)
4
redraw_icon(mainW%,field%(F%))
.
F$(F%)<>F$
F$(F%)=F$:changed%=
moan_err%,""
" changed%=
update_calcs(F%)
9
Other computed fields might depend on this one!
=changed%
calc_error(F$,F%,V$,R$)
replace(V$,",","\"):R$=
replace(R$,",","\")
Division by zero. Ignore - this error will often occur where
a field used as a divisor has not yet been filled in
softerror(V$,73):
No such field tag
softerror(V$,137):
No such FN/PROC
moan_err%:
softerror(F$+","+Tag$(F%),10)
softerror(
$+","+V$+","+R$,170)
check_record
F%,flag%,S$,V$
present%<7
nosave%
qbe%
F%=1
fields%
V$=vtype$(chartype%(F%))
selected(prefsW%,47)
V$="E"
?Rf%(F%)=32
! $Rf%(F%)=$(Rf%(F%)+1)
Check whether record has been changed (write to disc if so)...
6
"E","T","C":
$Rf%(F%)<>field$(F%)
flag%=
A
"X":
chartype%(F%)=60
$Rf%(F%)<>field$(F%)
flag%=
A
"L":
ScrollChanged%
write_scroller(REC%,F%):flag%=
...and that all mandatory fields have been filled in
V$="E"
;
$Rf%(F%)=""
mandatory%?F%=1
S$+=Tag$(F%)+"\"
flag%
write(fields%,key%):
blob_deleterestore("D"):
asterisk(
selected(prefsW%,21)
Validation is turned off
key(0)=""
Don't report on mandatory fields if no primary key
S$=""
S$,"\")>0
S$="s "+S$
S$=" "+S$
softerror(S$,61)
write(N%,k%)
key%,newrec%
close_file(dbasehandle%):
Access%
softerror("",14):
close_file(dbasehandle%)
template%=2
write_dbase(RA%,N%,
):template%=0:
PRI$=
key(0)
PRI$=""
retry%=
confirm(
msg("Err202")):
key$(0)
key%=0
Keys%
KEY$=
key(key%)
kl%=
(KEY$)
8F
insert(KEY$,key%,dupwarn%):
KEY$="*Failed*"
moan_err%,""
9! key$(key%)=KEY$:newrec%=
:"
k%=key%
addr=nextfree%
key%
key%=0
Keys%
KEY$=
key(key%)
KEY$<>key$(key%)
@[
key%=0
confirm(
msg("Err48"))
restore(1,fields%,"",-1):
moan_err%,""
A"
delete(key$(key%),key%)
B%
insert(KEY$,key%,dupwarn%)
KEY$="*Failed*"
KEY$=key$(key%)
E%
restore(1,fields%,"",-1)
F'
insert(KEY$,key%,dupwarn%)
moan_err%,""
key$(key%)=KEY$
J
key%
$Date%(file%)=
today
date%?file%=1
newtree%
write_dbase(REC%,N%,
newrec%
k%>0
rectify_address(k%)
autobalance%
(REC%
($Every%))=0
key%=0
Keys%
balance(key%)
key%
rectify_address(k%)
special%(3)
(libfunc$+"_function(3)")
rectify_address(key%)
S$=key$(key%)
S$=""
null%(key%)=
S$=ResKEY$:REC%=ResREC%
case%(key%)
u(S$)
a=val$=
type(key%):
val$="VAL"
kl%=KL%(key%)
kl%=
addr=
search(S$,key%,2)
write_dbase(R%,N%,logchanges%)
I%,F$,S$,dbasehandle%,flag%
g*dbasehandle%=
($database%+".Database")
#dbasehandle%=R%*Length%
logchanges%
newrec%
kF
write_log(R%,"New record: Subfile "+
(file%)+" "+
key(0),"")
l-
write_log(R%,logentry$,""):flag%=
I%=1
chartype%(I%)
39,40:F$=""
newrec%
F$=$Rf%(I%)
split_link(I%,R$,V$)
S%=
w/
dontincrement%=
S%+=1:F$=
(S%-1)
x calc$(I%)=V$+"|"+
F$=$Rf%(I%)
z
dontincrement%=
58:F$=
:F$=$Rf%(I%)
zerolen%?I%=0
#dbasehandle%,F$
flag%=
F$<>field$(I%)
chartype%(I%)<>59
%
F$=""
D$="<null>"
D$=F$
5
field$(I%)=""
S$="<null>"
S$=field$(I%)
2
write_log(-1,Tag$(I%)+": "+S$,"---> "+D$)
field$(I%)=F$
selected(prefsW%,44)
readsmarray(dbasehandle%,R%)
write_csv_rec(R%,csvform$,autocsvhandle%)
close_file(dbasehandle%)
split_link(F%,
L$,P%,F
L$=calc$(F%)
L$,1)="#":
/ P%=
L$,"#",2):V$=
L$,P%+1):R$=
L$,2,P%-2)
L$,"|")>0:
+ P%=
L$,"|"):V$=
L$,P%-1):R$=
L$,P%+1)
:R$="":V$=""
key(key%)
key2(key%,0)
key2(key%,loc%)
I%,W%,P%,S$,W$,T$,pad$,chars%,pos%,word%,wd%,field%,numeric%
I%=0
W%=KW%(key%,I%):W$=""
W%>0
chars%=W%
pos%=(W%>>8)
word%=(W%>>16)
field%=KF%(key%,I%)
chartype%(field%)
8
3,6,46,47,54,56,57,74,75,77,78,79:numeric%=
:numeric%=
:
loc%=0
S$=$Rf%(field%)+" "
S$=F$(field%)+" "
numeric%
word%
! C$=
S$,1):S$=
S$,2)
C$<>" "
W$+=C$
S$=""
wd%=0
: P%=
S$," "):w$=
S$,P%-1):S$=
S$,P%+1):wd%+=1
wd%=word%
S$=""
wd%=word%
W$=w$
chartype%(field%)
7
5,50,51,70,71,49,69,52,58,72,55,76,53,73:
, W$=
transform_date(KL%(key%),W$)
pos%
0:W$=
W$,chars%)
255:W$=
W$,chars%)
!
W$,pos%,chars%)
W$<>""
B
incspace%(key%)=
word%>0
W$+=
chars%-
(W$)," ")
T$+=W$
T$<>""
incspace%(key%)=
pad$=" "
pad$="#"
T$+=
KL%(key%)-
(T$),pad$)
case%(key%)
u(T$)
u(N$)
I%,B%
$key=N$
I%=0
(N$)-1
B%=key?I%
B%>96
B%<123
key?I%=B%
=$key
l(N$)
I%,B%
$key=N$
I%=0
(N$)-1
B%=key?I%
B%>64
B%<91
key?I%=B%
=$key
today
Y$,M$,D$,M%,date$
$,14,2)
$,5,2)
$,8,3)
Months$,M$)+2)
M%<10
M$="0"+
(M%)
&date$=D$+$datesep%+M$+$datesep%+Y$
=date$
date(key%)
SHkeyptr%(key%)<=0
I%=0
date%?I%=1
( $(SHkeyptr%(key%)+8+9*I%)=
today
$Date%(I%)=
today
check_date(F%,D$,place%,
date$)
I%,D%,M%,Y%,L%,P%,Q%,U$,d$,m$,y$
L%=0
I%=1
C$=
D$,I%,1)
C$<"0"
C$>"9"
P%=0
P%=I%
Q%=I%
P%=0
Q%=0
restore(F%,F%,
msg("Err102"),4):=
D$,P%-1))
D$,P%+1,Q%-P%-1))
D$,Q%+1))
Y%<0
D%<1
restore(F%,F%,"",4):=
M%<1
M%>12
restore(F%,F%,
msg("Err118"),4):=
(Y%
400)=0:U$=leap$:
Century year is leap year if divisible by 400
(Y%
100)<>0
(Y%
4)=0:U$=leap$:
otherwise not
:U$=nonleap$
U$,2*M%-1,2)
(DM$)
restore(F%,F%,
msg("Err119,"+DM$),4):=
(D%):
(d$)=1
d$="0"+d$
(M%):
(m$)=1
m$="0"+m$
(Y%):
(y$)=1
y$="0"+y$
(y$)<>2
(y$)<>4
restore(F%,F%,
msg("Err120"),4):=
(y$)=4
len%(F%)<10
y$,2)
(y$)=2
len%(F%)>=10
Y%<CentChange%
y$="20"+y$
y$="19"+y$
&date$=d$+$datesep%+m$+$datesep%+y$
place%=0
(date$)>len%(F%)
restore(F%,F%,
msg("Err7,"+date$),4):=
place%
0:$Rf%(F%)=date$:
redraw_icon(mainW%,field%(F%))
text(searchW%,1)=date$:
redraw_icon(searchW%,1)
convert_date(L%)
d$,m$,y$,M$,M%
$,5,2)
$,8,3)
Months$,M$)
M%=(P%+2)
$ m$=
(M%):
M%<10
m$="0"+m$
$,16-L%,L%)
&!=d$+$datesep%+m$+$datesep%+y$
transform_date(L%,K$)
Y$,M$,D$,T$,DW$,S$,P%,V%
V%=
P%=
Months$,K$)
P%>0
1" K$=
((P%+2)
3),2)
2$
Days$,K$)+2)
53
K$,1)="0"
V%>7
S$=Months$
S$=Days$
K$=
S$,V%*3-2,3)
5:K$=
days(K$))
8:K$=
K$,2)+
K$,3,4)+
K$,2)
(K$)<100
<! K$=
K$,4)+
K$,3,4)+
K$,2)
=#
K$,2)+
K$,5,4)+
K$,4)
DW$=
K$,3):Y$=
K$,10,4)
A. M$=
Months$,
K$,7,3))+2)
3),2)
D$=
K$,5,2):T$=
K$,15,8)
C% K$=Y$+$datesep%+M$+$datesep%+D$
T$<>""
K$+=$datesep%+T$
refresh_dates
key%
key%=0
Keys%
date(key%)
key%
days(date$)
Returns no. of elapsed days since 1 Jan 1900
D%,M%,Y%
date$=""
date$,2))
date$,4,2))
date$,7))
Y%<10:Y%+=2000
Y%<100:Y%+=1900
Z;!ordinals%=0:ordinals%!4=0:ordinals%!8=0:ordinals%!12=1
[3ordinals%!16=D%:ordinals%!20=M%:ordinals%!24=Y%
"Territory_ConvertOrdinalsToTime",-1,utctime%,ordinals%
=(utctime%!1)
33750
date(days%,L%)
`0$dateformat%="%DY"+$datesep%+"%MN"+$datesep%
L%=8
$dateformat%+="%YR"+
$dateformat%+="%CE%YR"+
utctime%!1=days%*33750
"Territory_ConvertDateAndTime",-1,utctime%,datebuffer%,16,dateformat%
datebuffer%?L%=13
=$datebuffer%
check_time(
time$,wi%,ic%)
I%,P%,Q%,H%,M%,S%,C$
I%=1
(time$)
C$=
time$,I%,1)
C$<"0"
C$>"9"
P%=0
P%=I%
Q%=I%
TimeFirst$
"H":
P%=0:H%=
(time$)
s-
Q%=0:H%=
(time$):M%=
time$,P%+1))
t;
(time$):M%=
time$,P%+1)):S%=
time$,Q%+1))
"S":
P%=0:S%=
(time$)
y-
Q%=0:M%=
(time$):S%=
time$,P%+1))
z;
(time$):M%=
time$,P%+1)):S%=
time$,Q%+1))
H%<0
H%>23
restore(Fieldnumber%,Fieldnumber%,"hours",94):=
M%<0
M%>59
restore(Fieldnumber%,Fieldnumber%,"minutes",94):=
S%<0
S%>59
restore(Fieldnumber%,Fieldnumber%,"seconds",94):=
!time$=
time(H%*3600+M%*60+S%)
text(wi%,ic%)=time$:
redraw_icon(wi%,ic%)
seconds(time$)
H%,M%,S%,secs%
(time$)<8
M%=
(time$)
S%=
time$,2))
H%=
(time$)
M%=
time$,4,2))
S%=
time$,2))
secs%=H%*3600+M%*60+S%
=secs%
time(secs%)
time$,hrs$,hrs%,L%,offset%
secs%<3600
FullTime%
5 $dateformat%="%MI"+$timesep%+"%SE%TZ"+
(0):L%=5
E $dateformat%="%24"+$timesep%+"%MI"+$timesep%+"%SE%TZ"+
(0):L%=8
"Territory_ReadCurrentTimeZone"
,offset%
secs%<3600
offset%=0:
Kludge!
,!utctime%=secs%*100-offset%:utctime%?4=0
"Territory_ConvertDateAndTime",-1,utctime%,datebuffer%,16,dateformat%
datebuffer%?11=13
time$=
$datebuffer%,L%)
=time$
validate(F%,
TabFields%,
name$)
selected(prefsW%,21)
row%,field%,Rows%,Rec%,ind%,sind%,pos%,start%,subst%,spos%,date$,subst$,L1%,L2%,L%,S$,exact%,extra$,S%,wi%,ic%,scrcol%,cols%,scroll%
name$=link$(F%)
)field%=
trailing_number(name$,exact%)
)subst%=
leading_number(scrcol%,name$)
chartype%(F%)
64,65,66,67:
S%=
scroller_number(F%)
cols%=scrolldata%(S%,8)
"Wimp_GetCaretPosition",,block%
wi%=!block%:ic%=block%!4
wi%=scrollerW%(S%)
ic%
cols%=scrcol%-1
scroll%=
:S$=$
text(wi%,ic%):L%=
:S$=$Rf%(F%):L%=
(S$):wi%=mainW%:ic%=field%(F%)
S$=""
fix%(F%)<>0
$Rf%(F%)=
fix_point(S$,F%):
redraw_icon(wi%,ic%)
chartype%(F%)=3
check_val(calc$(F%),S$)=
chartype%(F%)=5
check_date(F%,S$,0,date$)
chartype%(F%)=8
check_time(S$,wi%,ic%)
name$=""
name$,1)="#"
name$,1)="@"
table_number(name$):
T%<0
table_info(T%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)
S$=field$(F%)
TabFields%=0
,pos%=
table_field(field%,tabfieldlen%())
subst%<0
spos%=pos%
spos%=
table_field(subst%,tabfieldlen%())
%start%=SHtabptr%(T%)+offset%-Rec%
'ind%=start%+pos%:sind%=start%+spos%
exact%
1 cond$="row%>Rows% OR $ind%=S$ OR $sind%=S$"
cond$="row%>Rows% OR ($ind%=LEFT$(S$,L1%) AND L1%>0) OR ($sind%=LEFT$(S$,L2%) AND L2%>0)"
row%+=1
ind%+=Rec%:sind%+=Rec%
L1%=
($ind%):L2%=
($sind%)
(cond$)=
row%>Rows%
restore(F%,F%,S$+","+name$,5):=
exact%
,
$sind%=
S$,L2%):extra$=
S$,L%-L2%)
+
$ind%=
S$,L1%):extra$=
S$,L%-L1%)
ind%=start%+row%*Rec%
I%=0
TabFields%
, rel%(I%)=ind%:ind%+=tabfieldlen%(I%)+1
subst%>=0
subst$=$sind%
S$=subst$+extra$
scroll%
L%=sclen%(S%,scrcol%-1)
L%=len%(F%)
(S$)<=L%
text(wi%,ic%)=S$:
redraw_icon(wi%,ic%)
=row%
check_val(C$,N$)
min$,max$,P%,V,ok%
ok%=
N$=""
C$<>""
P%=
C$,"|")
P%>0
min$=
C$,P%-1)
max$=
C$,P%+1)
T
min$<>""
(min$)
ok%=
restore(F%,F%,Tag$(F%)+",(min="+min$+")",58)
T
max$<>""
(max$)
ok%=
restore(F%,F%,Tag$(F%)+",(max="+max$+")",59)
restore(from%,to%,E$,E%)
F%,V%,P%,wi%,ic%
E%>=0
softerror(E$,E%)
F%=from%
chartype%(F%)
1
21,27,28,32,34,39,40,45,59:
Do nothing
64,65,66,67:
S%=
scroller_number(F%)
*
"Wimp_GetCaretPosition",,block%
wi%=!block%:ic%=block%!4
wi%=scrollerW%(S%)
$
text(wi%,ic%)=cell$
set_caret(0,wi%,ic%)
redraw_icon(wi%,ic%)
field$(F%)<>$Rf%(F%)
$Rf%(F%)=field$(F%)
chartype%(F%)
0,1,2,3,4,5,8,63:
=
from%=to%
set_caret(0,mainW%,field%(from%))
41,42,43:
X
field$(F%)=" "
select(mainW%,field%(F%))
deselect(mainW%,field%(F%))
61,62:
= V%=
val(mainW%,field%(F%)):P%=
$V%,";S"):V%+=P%+1
field$(F%)
(0):$V%="no"
" ":$V%="yes"
C
chartype%(F%)=61
$V%="null"
$V%="dontcare"
)
redraw_icon(mainW%,field%(F%))
relations
F%,I%,W%,L%,N$,row%,col%,subst%,flags%,name$,x%,y%,vxmin%,vymax%,scrollx%,scrolly%,exact%,scrcol%,width%,height%
name$=link$(Fieldnumber%)
name$=""
$Rf%(Fieldnumber%)=""
F%=-1
&row%=
validate(Fieldnumber%,F%,N$)
'col%=
trailing_number(name$,exact%)
)subst%=
leading_number(scrcol%,name$)
row%>0
delete_icons(relateW%,0)
I%=0
0
col%:flags%=&00000531+(fcol%(8)<<24)
#
subst%:flags%=&0B000531
:flags%=&07000531
% L%=
($rel%(I%)):
L%<5
L%=5
% W%=
string_width($rel%(I%))+8
P R%=
create_icon(0,relateW%,0,-I%*36-36,W%,32,flags%,"",rel%(I%),-1,L%+1)
W%>width%
width%=W%
$RelTitle%=N$
height%=F%*36+36
#a !block%=0:block%!4=-height%:block%!8=width%:block%!12=0:
"Wimp_SetExtent",relateW%,block%
$5 !block%=mainW%:
"Wimp_GetWindowState",,block%
%L vxmin%=block%!4:vymax%=block%!16:scrollx%=block%!20:scrolly%=block%!24
&Q !block%=mainW%:block%!4=field%(Fieldnumber%):
"Wimp_GetIconState",,block%
'? x%=block%!16-scrollx%+vxmin%:y%=block%!20-scrolly%+vymax%
(7 !block%=relateW%:
"Wimp_GetWindowState",,block%
ScreenWidth%-x%<width%
width%=ScreenWidth%-x%
*) block%!4=x%+4:block%!12=x%+width%-4
+* block%!8=y%-height%-4:block%!16=y%-4
,/ block%!28=-1:
"Wimp_OpenWindow",,block%
"Wimp_CreateMenu",,relateW%,x%+4,y%-4
redraw(relateW%)
fix_point(F$,F%)
F$=""
fix%(F%)
-1:F$=
(V+0.5)):
Integer
Floating point. Do nothing
:@%=&01020009+fix%(F%)*256:F$=
(V),len%(F%)):@%=&90A
moveto(key%,P%,D%)
D%=(D%+1)
filter%
@- P%=
next_match(P%,D%,Filter$,finished%)
finished%
B2 matched%+=1:$
text(filterW%,5)=
(matched%)
C
redraw_icon(filterW%,5)
P%=
neighbour(key%,P%,D%)
P%=top
7:finished%=
neighbour(key%,P%,D%)
merging%
merge_next(filter%,key%,P%)
display(key%,P%)
next_match(P%,D%,S$,
nomore%)
REC%,abort%,passgo%,matched%,base%
N*dbasehandle%=
($database%+".Database")
base%=SHmarkptr%
P%=
neighbour(key%,P%,D%)
P%=top
nomore%=
T! P%=
neighbour(key%,P%,D%)
passgo%+=1
V+
passgo%>1
matched%
abort%=
P%=top
matched%=
Z
[ REC%=
rec_no(k$,key%,P%)
\'
readsmarray(dbasehandle%,REC%)
](
(S$)=
matched%=
:passgo%=0
matched%
abort%
close_file(dbasehandle%)
abort%
softerror($Query%,113)
display(key%,P%)
e3!block%=mainW%:
"Wimp_GetWindowState",,block%
template%=1
template%=2
template%=0
I%,L%,S%,S$,k$,ok%
-1,-2:
j, keybase%=SHkeyptr%(0):avail%=!keybase%
l:
!(keybase%+avail%)>0,template%=2,design%=
:ok%=
incr%=
($Increment%)
incr%>0
p+
change_length(RA%+incr%,
):ok%=
q0 keybase%=SHkeyptr%(0):avail%=!keybase%
softerror("",2)
s
ok%
design%:
x0 $RecInfo%="Make adjustments to fields"
y+
read(
,fields%,
,RA%,$database%)
I%=1
fields%
{I
vtype$(chartype%(I%))="S"
chartype%(I%)<>59
$Rf%(I%)=""
I%
template%=2:
~S $RecInfo%="Enter data which you want to appear by default on new records"
+
read(
,fields%,
,RA%,$database%)
P%=-2:
o rec%=!(keybase%+avail%+8+KL%(0)+1):$RecInfo%=$Subfile%(file%)+" Record="+
(rec%)+". (Copy)":key$()=""
F%=1
fields%
)
vtype$(chartype%(F%))="L"
7 L%=
blob_path(
,$database%,REC%,F%,64,b$)
L%>0
; L1%=
blob_path(
,$database%,rec%,F%,64,b1$)
7
"OS_CLI","Copy "+b$+" "+b1$+" ~C~V"
REC%=rec%
P%=-1:
d REC%=!(keybase%+avail%+8+KL%(0)+1):$RecInfo%=$Subfile%(file%)+" Record="+
(REC%)+". (New)"
+
printorder$<>""
F$()=field$()
+
read(
,fields%,
,RA%,$database%)
*
printorder$<>""
init_record
P $RecInfo%="""Query-by-example"": Enter required values in relevant fields"
read(
,fields%,
,RA%,$database%)
top:
### Empty subfile accessed ###
, keybase%=SHkeyptr%(0):avail%=!keybase%
( REC%=!(keybase%+avail%+8+KL%(0)+1)
read(
,fields%,
,RA%,$database%)
7:$RecInfo%=$Subfile%(file%)+" Record="+
(REC%)+". (New)"
REC%=
rec_no(k$,key%,P%)
read(
,fields%,
,REC%,$database%)
key$(key%)=k$
k$=
stripright(k$,"#")
ResKEY$=k$:ResREC%=REC%
> $RecInfo%=$Subfile%(file%)+" Record="+
(REC%)+" Key="+k$
selected (prefsW%,43)
filemem%(file%,key%)=P%
text_length(mainW%,starthere%)
Access%
set_caret(0,mainW%,starthere%)
identify_field(starthere%)
redraw(mainW%)
selected(prefsW%,19)
relations
changed%=
update_calcs(0)
*logentry$=$Subfile%(file%)+" "+
key(0)
altered%
$RecInfo%)<>"*"
$RecInfo%+=" *"
base%=SHmarkptr%
set_icon(markW%,0,(base%?REC%=1))
P%=-2
softerror("",130)
ScrollChanged%=
init_record
I%,F%,F$
I%=1
printorder$
F$=
printorder$,I%,2)
F%=
("&"+F$)
is_a_key(F%)<>0
$Rf%(F%)=F$(F%)
-------------------- Icon colours -------------------------------
colour(key%,type%)
type%=1 - Selected key,2 - Non-selected key,3 - Not a key
J%=0
KF%(key%,J%)>0
change_field_cols(key%,type%,J%)
change_field_cols(key%,type%,fld%)
key%
type%
)
1:dcol%=fcol%(0):fcol%=fcol%(1)
)
2:dcol%=fcol%(2):fcol%=fcol%(3)
type%
)
1:dcol%=fcol%(4):fcol%=fcol%(5)
)
2:dcol%=fcol%(6):fcol%=fcol%(7)
3:dcol%=&17:fcol%=&07
set_icon_cols(mainW%,desc%(KF%(key%,fld%)),dcol%)
6col%=
get_icon_cols(mainW%,field%(KF%(key%,fld%)))
(col%
16)=(fcol%(8)
16)
fcol%=(fcol%
&F0)
(col%
set_icon_cols(mainW%,field%(KF%(key%,fld%)),fcol%)
get_icon_cols(wi%,ic%)
;!block%=wi%:block%!4=ic%:
"Wimp_GetIconState",,block%
=block%?27
set_icon_cols(wi%,ic%,col%)
col%<0
col%=
(col%):block%!12=&0F000000
block%!12=&FF000000
0!block%=wi%:block%!4=ic%:block%!8=(col%<<24)
"Wimp_SetIconState",,block%
read_colours(f$)
F,I%
fcol%()=7
#F,fcol%(I%)
set_icon_cols(colW%,I%,fcol%(I%))
I%+=1
close_file(F)
I%=0
Keys%
colour(I%,2)
colour(key%,1)
I%=1
fields%
link$(I%)<>""
set_icon_cols(mainW%,field%(I%),fcol%(8))
mandatory%?I%=1
set_icon_cols(mainW%,field%(I%),fcol%(9))
write_colours(f$)
F,I%
I%=0
#F,fcol%(I%)
close_file(F)
find(S$,key%,disp%)
P%,F%,H%,recnum%,abort%,cond$
case%(key%)
u(S$)
S$,1)="#"
REC%=
S$,2))
REC%>=0
REC%<RA%
*
read(
,fields%,
,REC%,$database%)
$ S$=key$(key%):H%=1:recnum%=
1
select(searchW%,6):
deselect(searchW%,5)
$
softerror(S$,56):abort%=
S$,KL%(key%))
abort%
=addr
val$=
type(key%)
val$="VAL"
kl%=KL%(key%)
kl%=
search(S$,key%,1+H%)
P%<0
selected(searchW%,6)
F%=file%
file%=(file%+1)
top=8*file%+LH%
P%=
search(S$,key%,1+H%)
P%>0
file%=F%
P%>0
set_subfile(file%)
val$="VAL"
cond$="VAL($(SHkeyptr%(key%)+P%+8))=VAL(S$)"
cond$="LEFT$($(SHkeyptr%(key%)+P%+8),kl%)=S$"
matches%=0
P%>=0
recnum%:RecF%=
:addr=P%:matches%=1
P%>=0:RecF%=
### RecF% is used only by !DELETE in script language ###
1 matches%=
count_matches("first",cond$,addr)
selected(searchW%,6)
"$ F%=file%:file%=(file%+1)
#
top=8*file%+LH%
P%=
search(S$,key%,1)
&=
P%>0
matches%+=
count_matches("first",cond$,Q%)
file%=(file%+1)
file%=F%
top=8*file%+LH%
recnum%:
softerror("#"+
(REC%),55)
disp%
addr=
(P%):flash%=KF%(key%,0):state%=
selected(mainW%,field%(flash%))
addr=P%
text(searchW%,7)=
(matches%)+" found":
redraw_icon(searchW%,7)
merging%:
merge_next(filter%,key%,addr)
disp%:
display(key%,addr)
3 =addr
count_matches(end$,c$,
### Scan back to FIRST match ###
P%=
neighbour(key%,P%,0)
### ...and point at it ###
neighbour(key%,P%,1)
end$="first"
Q%=P%
### Then scan to last match ###
N%+=1
P%=
neighbour(key%,P%,1)
### ...and point at it ###
neighbour(key%,P%,0)
end$="last"
Q%=P%
lookup(F%)
K$,S%,P%,Q%,pos%
check_record
S%=Rf%(F%)
($S%)
$S%<>""
chartype%(F%)<9
"Wimp_GetCaretPosition",,block%
pos%=block%!20:Q%=pos%
Q%<L%
S%?Q%<>44
Q%+=1
Q%+=1
pos%=0
P%=1
P%=pos%-1
P%>0
S%?P%<>44
P%-=1
P%=0
P%=1
P%+=2
K$=
$S%,P%,Q%-P%)
addr=
find(K$,key%,
get_it_in(filename$)
"Hourglass_On"
"OS_File",5,filename$
d%,,ftype%
a9ftype%=(ftype%>>8)
&fff:wi%=block%!20:ic%=block%!24
b!Scroller%=
scroller_num2(wi%)
field%=(ic%+1)
wi%=mainW%
chartype%(field%)
fP
d%<>2
transfer_blob(wi%,ic%,filename$,d%,ftype%):d%=0:ftype%=0
gF
transfer_blob(wi%,ic%,filename$,d%,ftype%):d%=0:ftype%=0
h-
Stop later lines from grabbing file
d%=2
wi%
reformW%:
n-
"OS_File",5,filename$+".Form"
d%=1
p+ $Newform%="":
redraw_icon(wi%,12)
qI $Reformatted%=filename$:
set_caret(0,wi%,6):
redraw_icon(wi%,6)
r)
shade(wi%,0,
shade(wi%,2,
softerror("",28)
t
mergebaseW%:
v3 $
text(wi%,3)=filename$:
redraw_icon(wi%,3)
w7
shade(wi%,4,
shade(wi%,7,
shade(wi%,1,
set_caret(0,wi%,4)
z!
leaf(filename$),1)
"!":
|1
### Is it an Impression document? ###
}3
"OS_File",5,filename$+".!DocData"
d%=1
"
ready_to_merge(&2000)
4
### Is it a Powerbase application? ###
;
"OS_File",5,filename$+".Indices"
d%,,type%
U
d%=2
"OS_CLI","Rename "+filename$+".Indices "+filename$+".Indexes"
C
"OS_File",5,filename$+".Indexes"
d%,,type%
$
d%=2
check_record
.
present%>0
design%=
$ leaf$=
leaf(filename$)
- $Title%=
leaf$,2,NameLength%-1)
1
open_files(filename$):SaveCount%=0
5
### It's an ordinary directory folder ###
1
transfer_blob(wi%,ic%,filename$,d%,-1)
ftype%
;
&7f1:
load_table(filename$,
display(key%,addr)
z
&7f2:
wi%=reformW%
leaf(filename$)="Form"
$Reformatted%,".")=0
$Newform%=filename$:
redraw_icon(wi%,12)
)
&7f3:
load_selection(filename$)
-
&7f4:
load_query(filename$,wi%,ic%)
8
&7f5:
get_options(printW%,printerW%,filename$)
B
&dfe:$
text(csvW%,13)=filename$:
start_import("CSV",wi%)
?
&ff9,&aff:
transfer_blob(wi%,ic%,filename$,d%,ftype%)
+
&bc5,&b27:
ready_to_merge(ftype%)
&fff:
1 F=
(filename$):header$=
close_file(F)
wi%
mainW%:
chartype%(field%)
?
36,39:
transfer_blob(wi%,ic%,filename$,d%,ftype%)
2
header$,7)="!SCRIPT"
present%=7
(
execute_script(filename$)
D
text(csvW%,13)=filename$:
start_import("text",wi%)
"
scrollerW%(Scroller%):
#
header$,7)="!SCRIPT"
&
execute_script(filename$)
C
import_to_scroller(Scroller%,filename$):
asterisk(
%
tableW%(Tablenumber%),-2:
> $
text(csvW%,13)=filename$:
start_import("text",wi%)
:
customise%
(libfunc$+"_drop(wi%,ic%)")
"Hourglass_Off"
ready_to_merge(doctype%)
selected(passW%,13)
present%=7
doctype%
A
&bc5:$ImpulseApp%="Impression":$mergewith%=$ImpulseApp%
A
&b27:$ImpulseApp%="OvationPro":$mergewith%=$ImpulseApp%
redraw_icon(mergeW%,9)
document$=
leaf(filename$)
document$,1)="!"
document$=
document$,2)
"OS_CLI","Filer_Run "+filename$
Impulse_wait%=
softerror("",107)
open_files(f$)
I%,J%,F%,A$
### Delete redundant files if present ###
"OS_CLI","Remove "+f$+".Winsize"
"OS_CLI","Remove "+f$+".Choices"
read_sys_vars(f$)
leaf$=
leaf(f$)
"OS_File",5,f$+".Config"
d%=1
get_configuration(f$+".Config","local")
#$Title%=
leaf$,2,NameLength%-1)
"OS_File",5,f$+".Database"
d%,,type%
d%=1
present%=present%
type%=(type%>>8)
&fff
type%=&7f2
M dbtype$="old":$Util1%="Adjust format...":$Util2%="New record format..."
dbtype$="new":$Util1%="Alter format...":$Util2%="Rebuild database..."
"OS_File",5,f$+".PrimaryKey"
d%=1
present%=present%
"OS_File",5,f$+".Form"
d%=1
present%=present%
9SHlogoptr%=
extend_named_sliding_block(logoanchor%,8)
"OS_File",5,f$+".UsrSprites"
d%,,,,len%
d%=1
@ SHlogoptr%=
extend_named_sliding_block(logoanchor%,len%+8)
!SHlogoptr%=len%+4
"OS_File",255,f$+".UsrSprites",SHlogoptr%+4
logosloaded%=
"OS_File",5,f$+".Title"
d%,,,,len%
d%=1
B SHtitleptr%=
extend_named_sliding_block(titleanchor%,len%+8)
"OS_File",255,f$+".Title",SHtitleptr%+4
!SHtitleptr%=len%+4
HasTitle%=1
HasTitle%=0
$database%=f$
"OS_CLI","Set Dbase$Dir "+f$
present%
0,1,5:Access%=
:Modify%=
resume_opening
access(f$,accessW%)
resume_opening
wimp_error(
,254,0,
msg("Err24"))
read_sys_vars(f$)
E%,F,A$,L$,S$
(f$+".!Run")
S$=
S$,"Acl$Dir")>0
A$=S$
S$,"Log$Dir")>0
L$=S$
close_file(F)
A$=""
A$="Set Acl$Dir "+f$
L$=""
L$="Set Log$Dir "+f$
"XOS_ReadVarVal","Acl$Dir",,-1
,,E%:
E%=0
"OS_CLI",A$
"XOS_ReadVarVal","Log$Dir",,-1
,,E%:
E%=0
"OS_CLI",L$
access(f$,wi%)
F,I%,L%,P%,col%,last%,keybase%,login%,attempts%,old%,file$
'file$=f$+".Cols":last%=8:F=
(file$)
F=0
file$=f$+".Colours":last%=6:F=
(file$)
F>0
old%=
I%=0
last%
,
last%=6
#F,col%
#F,fcol%(I%)
write_colours(f$+".FieldCols")
(f$+".Data")
F=0
fatal_err%,
msg("Err18,"+f$+".Data")
#F,S$:$Read%=
encrypt(S$,
#F,S$:$Write%=
encrypt(S$,
#F,S$:$Manager%=
encrypt(S$,
I%+=1
#F,Z%
set_icon(passW%,I%+8,Z%)
close_file(F)
"ShowTools%=
selected(passW%,9)
old%
passwords(0,passW%,4,4):
"OS_CLI","Remove "+file$
"OS_File",5,"<Acl$Dir>.Acl"
d%:acl%=(d%=1)
$Manager%=""
acl%=
Access%=
:Modify%=
9$AccessTitle%="!Powerbase opening "+
leaf($database%)
acl%
position_window(wi%,0,0,0,310,0,110):refuse$="Access denied"
position_window(wi%,0,0,0,200,0,0):refuse$="Password not known"
"Hourglass_Smash"
$0!block%=wi%:
"Wimp_GetWindowState",,block%
block%!4,block%!8,block%!12-block%!4,block%!16-block%!8
'( cancel%=
:login%=
:accessbutton%=0
$Password%="":$UserID%=""
redraw_icon(wi%,1):
redraw_icon(wi%,0)
*+ $
text(wi%,5)="Type in your password"
acl%
set_caret(0,wi%,0)
set_caret(0,wi%,1)
poll(
accessbutton%>0
accessbutton%
2:cancel%=
2+ password$=$Password%:user$=$UserID%
acl%
F=
("<Acl$Dir>.Acl")
6!
#F,id$,personal$,pw%
7X
id$=
encrypt(user$,
personal$=
encrypt(password$,
pw%>0
login%=
login%
close_file(F)
user$="<none>"
password$
=&
$Manager%:pw%=3:login%=
>$
$Write%:pw%=2:login%=
?#
$Read%:pw%=1:login%=
A
(login%
cancel%)
$
text(wi%,5)=refuse$
F!
set_icon_cols(wi%,5,&1B)
delay%=
H
poll(
>delay%
K!
set_icon_cols(wi%,5,&17)
attempts%+=1
MR att$(attempts%)=
(attempts%)+","+
leaf($database%)+","+user$+","+password$
login%
cancel%
attempts%=3
P#Access%=(pw%>1):Modify%=(pw%>2)
close_window(wi%)
0,0,ScreenWidth%,ScreenHeight%
attempts%=3
T" user$="<unrecognised>":pw%=0
open_log("<Log$Dir>.Log",
Even if logging not normally enabled Powerbase will log any
three-times failed attempt to open password-protected database.
I%=1
Y2
write_log(-1,
msg("Err122,"+att$(I%)),"")
close_log("<Log$Dir>.Log")
close_down
=login%
resume_opening
"Hourglass_On"
selected(passW%,16)
open_log("<Log$Dir>.Log",
($database%+".Subfiles")
I%=0
f*
0:$Subfile%(I%)="Subfile "+
S$=
i%
S$=""
S$="Subfile "+
$Subfile%(I%)=S$
close_file(F)
load_user_functions(f$)
"OS_File",5,f$+".FieldCols"
d%=1
read_colours($database%+".FieldCols")
"OS_File",5,f$+".PrintRes.!PrintOpts"
d%=1
get_options(printW%,printerW%,f$+".PrintRes.!PrintOpts")
"OS_File",5,f$+".Preference"
d%=1
get_preferences(prefsW%,f$+".Preference")
"OS_File",5,f$+".CSVoptions"
d%=1
get_csv_options(f$+".CSVoptions")
deselect(prefsW%,36):
select(prefsW%,35):
shade(prefsW%,35,
f$,3)="RAM"
ram%=
tick(markM%,0,
shade(csvW%,18,Modify%)
shade(csvW%,21,Access%)
shade(printW%,31,Modify%)
shade(printW%,34,Access%)
shade(prefsW%,36,Modify%)
shade(prefsW%,38,Access%)
shade(prefsW%,45,
lit(iconbarM%,1,
lit(iconbarM%,2,Modify%)
lit(iconbarM%,3,
lit(iconbarM%,4,Modify%)
lit(mainM%,6,ShowTools%
(Tools%=1))
lit(miscM%,0,Access%)
lit(miscM%,1,Modify%)
lit(miscM%,2,Access%)
lit(miscM%,3,Access%)
lit(miscM%,4,Access%)
lit(miscM%,5,Access%)
lit(validateM%,0,Access%)
lit(fieldM%,0,Access%)
lit(fieldM%,2,Access%)
lit(fieldM%,3,Access%)
lit(tableM%,0,Access%)
lit(tableM%,3,Access%)
lit(designM%,2,((present%
4)=0))
I%=0
lit(utilityM%,I%,(present%=7))
present%<4
design%=
:markpane%=
lit(designM%,7,
fields%=
get_form(Fptr%)
Lchartype%(0)=100:chartype%(MaxFields%+1)=100:chartype%(MaxFields%+2)=100
fields%>0
starthere%=
start_at
" Lastwritable%=
last_writable
$ fieldsM%=
field_menu(items%,1)
$Reformatted%=""
adjust%
lit(designM%,3,(fields%>0))
present%
$RecInfo%=
msg("Err156")
I%=1
lit(designM%,I%,
lit(designM%,6,
get_winpos
SHformptr%=0
D SHformptr%=
extend_named_sliding_block(formanchor%,SHclaim%)
Fptr%=SHformptr%
fields%=0:Fieldnumber%=0
$Reformatted%=""
$RecInfo%=
msg("Err157")
$RecInfo%=
msg("Err159")
first_writable>0
lit(designM%,4,
lit(designM%,5,
get_winpos
$RecInfo%=
msg("Err158")
"OS_File",5,$database%+".Database"
,,,,len%
- RA%=(len%
Length%)-1:$Records%=
(RA%)
first_writable>0
get_winpos
lit(utilityM%,0,
complete(4)
softerror("",203)
shade(prefsW%,45,
lit(mainM%,8,
selected(passW%,13))
lit(mainM%,9,
selected(passW%,13))
lit(mainM%,10,
selected(passW%,13))
lit(mainM%,2,
selected(passW%,14))
"OS_File",5,$database%+".Database"
,,,,len%
RA%=(len%
Length%)-1
$Records%=
(RA%)
(len%
Length%)<>0
rectify
@ SHmarkptr%=
extend_named_sliding_block(markanchor%,RA%+20)
clear_marks(RA%)
load_index($database%+".PrimaryKey",0,
( key%=0:file%=0:
set_subfile(file%)
# $Subfilename%=$Subfile%(key%)
set_keydata(key%)
X keybase%=SHkeyptr%(0):
keybase%!4>0
$Increment%=
(keybase%!4)
$Increment%="0"
load_indexes
get_tables
load_marks
count(key%,RU%):
update_stats
get_winpos
load_calcs
auto_csv(
selected(prefsW%,44))
limit_actions(Access%,
addr=
moveto(key%,top,1)
"Hourglass_Off"
iconbar_icon($Title%)
Apath$=$database%+".Customise.":name$=$Title%:lib$=path$+name$
"OS_File",5,lib$
d%,,,,len%
d%=0
name$="Demo":lib$=path$+name$:
"OS_File",5,lib$
d%,,,,len%
d%=0
0 path$=PbaseDir$+"."+program$+".Customise."
G name$=progname$:lib$=path$+name$:
"OS_File",5,lib$
d%,,,,len%
d%=0
name$="Demo":lib$=path$+name$:
"OS_File",5,lib$
d%,,,,len%
delete_icons(keypadW%,29):toolheight%=770:padheight%=316
d%=1
libfunc$="FN_"+name$
N%=-1
N%+=1
lib$(N%)=lib$
N%=NextLib%
loadable
= lib%(N%)=
Flag used libraries to avoid memory leak
library$
lib$:new%=
:library$=lib$:new%=
Tools%
.
1:xm%=600:ym%=-208:xw%=12:yw%=-208
-
2:xm%=92:ym%=-816:xw%=12:yw%=-816
J customise%=
(libfunc$+"_setup(LEFT$(path$),xm%,ym%,xw%,yw%,new%)")
Tools%=2
open_window(mainW%)
exit%=
special%(0)
(libfunc$+"_function(0)")
loadable
ok%=
N%=MaxLibs%:
softerror("",236):ok%=
N%=NextLib%:
unique(lib$,N%+1)
O
name$<>"Demo"
dir($database%)<>CustDir$
softerror(CustDir$,134)
# lib$(N%)=lib$:NextLib%+=1
1
len%>MaxSize%
MaxSize%=len%:
lib$()
clear_marks(N%)
I%=0
SHmarkptr%!I%=0
deselect(markW%,0)
shade(markW%,1,
MarkedRecs%=0
tick(markM%,0,
tick(markM%,1,
val(markW%,0)="Snull,yes"
save_marks
selected(prefsW%,48)
f$=$database%+".Marks"
MarkedRecs%>0
C
ticked(markM%,1)
SHmarkptr%?RA%=255
SHmarkptr%?RA%=1
& SHmarkptr%!(RA%+1)=MarkedRecs%
2
save(f$,&ffd,SHmarkptr%,SHmarkptr%+RA%+5)
"
"OS_CLI","Remove "+f$
load_marks
d%,f$
selected(prefsW%,48)
f$=$database%+".Marks"
"OS_File",5,f$
d%=1
'&
"OS_File",255,f$,SHmarkptr%
(& MarkedRecs%=SHmarkptr%!(RA%+1)
)(
tick(markM%,0,SHmarkptr%?RA%=1)
**
tick(markM%,1,SHmarkptr%?RA%=255)
warn_of_marks
rectify
REC%,I%,J%,F$
REC%=-1
3*dbasehandle%=
($database%+".Database")
REC%<RA%
(F$)<>0
REC%+=1
6!
#dbasehandle%=Length%*REC%
F$=
#dbasehandle%
(F$)=0
softerror("",109)
;!
#dbasehandle%=REC%*Length%
"Hourglass_On"
I%=REC%
>!
#dbasehandle%=I%*Length%
J%=1
fields%
#dbasehandle%,""
B>
"Hourglass_Percentage",((I%-REC%)*100)
(RA%-REC%)
"Hourglass_Off"
RA%+=1
#dbasehandle%=(RA%+1)*Length%
close_file(dbasehandle%)
get_configuration(f$,z$)
F,S$,C$,P%
S$=
S$,1)<>"|"
Q+ P%=
S$," "):C$=
S$,P%+1):S$=
S$,P%-1)
C$=
stripright(C$," ")
"Fields":
U(
z$="main"
MaxFields%=
V>
MaxFields%>127
close_file(F):
msg("Err185")
W/
"Keys":
z$="main"
MaxKeys%=
X/
"Tabs":
z$="main"
MaxTabs%=
Y1
"Cols":
z$="main"
MaxCols%=
(C$)-1
Z3
"Scrolls":
z$="main"
MaxLists%=
[2
"MaxLibs":
z$="main"
MaxLibs%=
\/
"CustDir":
z$="main"
CustDir$=C$
]-
C$="Default"
CustDir$=PbaseDir$
^7
"BTime":
z$="main"
Bannertime%=
(C$)*100
_9
"LeftOpen":
z$="main"
leftmenu%=(C$="YES")
`.
"Tools":
z$="main"
Tools%=
a$
"BackGnd":winback%=
b"
"Upper":uc%=(C$="YES")
c!
"DirOpts":dirdisp$=C$
d"
"ExtFiles":objname$=C$
e#
"Query":QBE%=(C$="QBE")
f_
"PathLen":RLmax%=
(C$):
C$)="A"
Remotepath$="Absolute"
Remotepath$="Relative"
g,
"FontAdj":FontAdjust%=(C$="YES")
h)
"Multi":multitask%=(C$="YES")
i+
"MarkPane":markpane%=(C$="YES")
j'
"NameLen":NameLength%=
k@
"ButtonAtts":Buttonwidth%=
(C$):WithLeaf%=(
C$)="L")
l,
"DialDelay":DialDelay%=
(C$)*100
m)
"TimeFirst":TimeFirst$=
C$,1)
n+
"FullTime":FullTime%=(C$="YES")
o*
"CentChange":CentChange%=
p"
"Output":Output%=
q
close_file(F)
get_options(wi%,wi2%,f$)
F,S$,C$,P%
f$,20)="Resources.!PrintOpts"
prtopts$=""
prtopts$=f$
S$=
S$,1)<>"|"
P%=
S$," ")
2
P%>0
S$,P%+1):S$=
S$,P%-1)
C$=""
"Destination":
-
deselect(wi%,
selected_esg(wi%,4))
"window":ic%=22
"file":ic%=23
"printer":ic%=25
select(wi%,ic%)
set_dest_sprite
"Headings":
-
deselect(wi%,
selected_esg(wi%,1))
)
"descriptor":
select(wi%,2)
"
"tag":
select(wi%,1)
%
"none":
select(wi%,36)
"Format":
-
deselect(wi%,
selected_esg(wi%,3))
/
deselect(wi2%,
selected_esg(wi2%,2))
C$,5)
%
"horiz":
select(wi%,15)
$
"vert":
select(wi%,16)
%
"table":
select(wi2%,7)
%
"label":
select(wi2%,8)
"Scroller":
-
deselect(wi%,
selected_esg(wi%,6))
*
"Single row":
select(wi%,40)
'
"Columns":
select(wi%,41)
'
"CellSep":$
text(wi%,50)=C$
'
"RowTerm":$
text(wi%,51)=C$
"ShrinkRow":
%
set_icon(wi%,43,(C$="ON"))
*
shade(wi%,43,
selected(wi%,40))
*
shade(wi%,51,
selected(wi%,40))
/
"Expand":
set_icon(wi%,5,(C$="ON"))
3
"ExpHeader":
set_icon(wi%,37,(C$="ON"))
2
"Uppercase":
set_icon(wi%,6,(C$="ON"))
0
"Header":
set_icon(wi%,28,(C$="ON"))
.
"Page1":
set_icon(wi%,4,(C$="ON"))
0
"Footer":
set_icon(wi%,29,(C$="ON"))
.
"Date":
set_icon(wi%,11,(C$="ON"))
0
"Shrink":
set_icon(wi%,24,(C$="ON"))
4
"PageNumber":
set_icon(wi%,35,(C$="ON"))
)
"PageLength":$
text(wi%,9)=C$
%
"Title":$
text(wi%,10)=C$
)
"TextWidth":$
text(wi%,18)=C$
,
"ColumnSpacer":$
text(wi%,26)=C$
"Orientation":
/
deselect(wi2%,
selected_esg(wi2%,1))
'
"upright":
select(wi2%,3)
(
"sideways":
select(wi2%,4)
select(wi2%,3)
"PrintCols":
/
deselect(wi2%,
selected_esg(wi2%,9))
"
"1":
select(wi2%,80)
"
"2":
select(wi2%,81)
"
"3":
select(wi2%,85)
"
"4":
select(wi2%,86)
select(wi2%,80)
.
shade(wi2%,82,
selected(wi2%,80))
'
"Gutter":$
text(wi2%,82)=C$
+
"HeaderFont":$
text(wi2%,57)=C$
)
"BodyFont":$
text(wi2%,71)=C$
"FontSize":
/
deselect(wi2%,
selected_esg(wi2%,7))
shade(wi2%,65,
"
"8":
select(wi2%,61)
#
"10":
select(wi2%,62)
#
"12":
select(wi2%,63)
#
"14":
select(wi2%,64)
2
text(wi2%,65)=C$:
shade(wi2%,65,
2
"Hcolour":
set_icon_cols(wi%,53,
(C$))
2
"Bcolour":
set_icon_cols(wi%,54,
(C$))
2
"Rcolour":
set_icon_cols(wi%,55,
(C$))
"Margins":
live%()=14,15,16,18,-1
C$="printer"
,
select(wi2%,68):
enable(wi2%,
0
deselect(wi2%,68):
enable(wi2%,
(
"Lmargin":$
text(wi2%,14)=C$
(
"Rmargin":$
text(wi2%,15)=C$
(
"Tmargin":$
text(wi2%,16)=C$
(
"Bmargin":$
text(wi2%,18)=C$
"LineSpace":
!
C$)<>"%"
C$="120%"
$
text(wi2%,56)=C$
'
"Copies":$
text(wi2%,45)=C$
"TabColumns":
P%=
C$,",")
# $
text(wi2%,23)=
C$,P%-1)
# $
text(wi2%,24)=
C$,P%+1)
<
"ExtraRows":$
text(wi2%,69)=
(C$))
"LabelRowOf":
/
deselect(wi2%,
selected_esg(wi2%,5))
(C$)
select(wi2%,28)
select(wi2%,29)
select(wi2%,30)
select(wi2%,53)
+
"LabelWidth":$
text(wi2%,32)=C$
,
"LabelHeight":$
text(wi2%,34)=C$
"Substitute":
P%=
C$,"|")
P%>0
select(wi2%,39)
% $
text(wi2%,78)=
C$,P%-1)
% $
text(wi2%,40)=
C$,P%+1)
F
deselect(wi2%,39):$
text(wi2%,78)="":$
text(wi2%,40)=""
7
shade(wi2%,78,(P%>0)):
shade(wi2%,40,(P%>0))
*
"FirstLine":$
text(wi2%,51)=C$
)
"LastLine":$
text(wi2%,52)=C$
3
"PrintKey":
set_icon(wi2%,41,(C$="ON"))
"Units":
/
deselect(wi2%,
selected_esg(wi2%,8))
#
"mm":
select(wi2%,48)
#
"in":
select(wi2%,38)
#
"pt":
select(wi2%,77)
label_units(C$)
"SortOn":
$
set_icon(wi%,46,(C$<>""))
$
text(wi%,44)=C$
!
shade(wi%,44,(C$<>""))
! 0
"SortDir":
set_icon(wi%,47,(C$="A"))
0
"Pause":
set_icon(wi2%,87,(C$="ON"))
close_file(F)
enable_print_setup(wi%,wi2%)
save_options(wi%,wi2%,f$)
selected_esg(wi%,4)
23:C$="file"
25:C$="printer"
:C$="window"
#F,"Destination "+C$
selected_esg(wi%,1)
2:C$="descriptor"
36:C$="none"
:C$="tag"
#F,"Headings "+C$
!"#
selected(wi%,16):C$="vert"
!#$
selected(wi2%,7):C$="table"
!$$
selected(wi2%,8):C$="label"
:C$="horiz"
#F,"Format "+C$
selected_esg(wi%,6)
41:C$="Columns"
:C$="Single row"
#F,"Scroller "+C$
#F,"CellSep "+$
text(wi%,50)
#F,"RowTerm "+$
text(wi%,51)
selected(wi%,43)
C$="ON"
C$="OFF"
#F,"ShrinkRow "+C$
selected(wi%,5)
C$="ON"
C$="OFF"
#F,"Expand "+C$
selected(wi%,37)
C$="ON"
C$="OFF"
#F,"ExpHeader "+C$
selected(wi%,6)
C$="ON"
C$="OFF"
#F,"Uppercase "+C$
selected(wi%,28)
C$="ON"
C$="OFF"
#F,"Header "+C$
selected(wi%,4)
C$="ON"
C$="OFF"
#F,"Page1 "+C$
selected(wi%,29)
C$="ON"
C$="OFF"
#F,"Footer "+C$
selected(wi%,11)
C$="ON"
C$="OFF"
#F,"Date "+C$
selected(wi%,24)
C$="ON"
C$="OFF"
#F,"Shrink "+C$
selected(wi%,35)
C$="ON"
C$="OFF"
#F,"PageNumber "+C$
#F,"PageLength "+$
text(wi%,9)
#F,"Title "+$
text(wi%,10)
#F,"TextWidth "+$
text(wi%,18)
#F,"ColumnSpacer "+$
text(wi%,26)
selected_esg(wi2%,1)
4:C$="sideways"
:C$="upright"
#F,"Orientation "+C$
selected_esg(wi2%,9)
81:C$="2"
85:C$="3"
86:C$="4"
:C$="1"
#F,"PrintCols "+C$
#F,"Gutter "+$
text(wi2%,82)
#F,"HeaderFont "+$
text(wi2%,57)
#F,"BodyFont "+$
text(wi2%,71)
selected_esg(wi2%,7)
61:C$="8"
62:C$="10"
63:C$="12"
64:C$="14"
:C$=$
text(wi2%,65)
#F,"FontSize "+C$
!^ C$=
get_icon_cols(wi%,53))
#F,"Hcolour "+C$
!` C$=
get_icon_cols(wi%,54))
#F,"Bcolour "+C$
!b C$=
get_icon_cols(wi%,55))
#F,"Rcolour "+C$
selected(wi2%,68)
C$="printer"
C$="program"
#F,"Margins "+C$
#F,"Lmargin "+$
text(wi2%,14)
#F,"Rmargin "+$
text(wi2%,15)
#F,"Tmargin "+$
text(wi2%,16)
#F,"Bmargin "+$
text(wi2%,18)
text(wi2%,56)
C$)<>"%"
C$+="%"
#F,"LineSpace "+C$
#F,"Copies "+$
text(wi2%,45)
#F,"TabColumns "+$
text(wi2%,23)+","+$
text(wi2%,24)
#F,"ExtraRows "+$
text(wi2%,69)
selected_esg(wi2%,5)
28:C%=1
29:C%=2
53:C%=4
:C%=3
#F,"LabelRowOf "+C$
#F,"LabelWidth "+$
text(wi2%,32)
#F,"LabelHeight "+$
text(wi2%,34)
selected(wi2%,39)
C$=$
text(wi2%,78)+"|"+$
text(wi2%,40)
C$="OFF"
#F,"Substitute "+C$
#F,"FirstLine "+$
text(wi2%,51)
#F,"LastLine "+$
text(wi2%,52)
selected(wi2%,41)
C$="ON"
C$="OFF"
#F,"PrintKey "+C$
selected_esg(wi2%,8)
38:C$="in"
77:C$="pt"
:C$="mm"
#F,"Units "+C$
selected(wi%,46)
C$=$
text(wi%,44)
C$=""
#F,"SortOn "+C$
selected(wi%,47)
C$="A"
C$="D"
#F,"SortDir "+C$
selected(wi2%,87)
C$="ON"
C$="OFF"
#F,"Pause "+C$
close_file(F)
"OS_File",18,f$,&7f5
get_preferences(wi%,f$)
F,S$,C$,P%
S$=
S$,1)<>"|"
- P%=
S$," "):C$=
S$,P%+1):S$=
S$,P%-1)
(
"DateSeparator":$datesep%=C$
(
"TimeSeparator":$timesep%=C$
"WildcardS":$wc%=C$
"WildcardM":$ws%=C$
5
"Recalculate":
set_icon(wi%,14,(C$="ON"))
@
"NewCopy":kill%=(C$<>"ON"):
set_icon(wi%,12,
kill%)
U
"CaseSpecific":
set_icon(wi%,30,(C$="ON")):
set_icon(queryW%,1,(C$="ON"))
5
"BlankRecord":
set_icon(wi%,15,(C$="ON"))
8
"MoveDescriptor":
set_icon(wi%,16,(C$="ON"))
C
"ImpulseClient":$mergewith%=C$:$ImpulseApp%=$mergewith%
P
"Validate":
set_icon(wi%,21,(C$="ON")):
shade(keypadW%,18,(C$="ON"))
4
"ShowLinked":
set_icon(wi%,19,(C$="ON"))
1
"Warning":
set_icon(wi%,20,(C$="ON"))
"Autosave":
-
deselect(wi%,
selected_esg(wi%,2))
C$,4)
/
"OFF":autosave%=0:$Interval%="10"
2
"WARN":autosave%=1:$Interval%=
C$,5)
2
"AUTO":autosave%=2:$Interval%=
C$,5)
#
select(wi%,29-autosave%)
'
shade(wi%,25,(autosave%<>0))
"Autobalance":
C$,4)
/
"OFF":autobalance%=
:$Every%="25"
2
"AUTO":$Every%=
C$,5):autobalance%=
I
set_icon(wi%,31,autobalance%):
shade(wi%,32,
selected(wi%,31))
,
"Duplication":dupwarn%=(C$="ON")
L
set_icon(wi%,34,dupwarn%):
shade(prefsW%,34,
selected(passW%,15))
5
"DefaultAction":
set_icon(wi%,41,C$="ON")
4
"StripLeading":
set_icon(wi%,47,C$="ON")
5
"StripTrailing":
set_icon(wi%,42,C$="ON")
5
"RememberPlace":
set_icon(wi%,43,C$="ON")
2
"SaveMarked":
set_icon(wi%,48,C$="ON")
/
"AutoCSV":
set_icon(wi%,44,C$="ON")
0
"AutoOpen":
set_icon(wi%,49,C$="ON")
&
"SaveStart":$StartHere%=C$
close_file(F)
save_preferences(wi%,f$)
F,C$
#F,"DateSeparator "+$datesep%
#F,"TimeSeparator "+$timesep%
#F,"WildcardS "+$wc%
#F,"WildcardM "+$ws%
#F,"ImpulseClient "+$mergewith%
selected(wi%,12)
C$="ON"
C$="OFF"
#F,"NewCopy "+C$
selected(wi%,30)
C$="ON"
C$="OFF"
#F,"CaseSpecific "+C$
selected(wi%,14)
C$="ON"
C$="OFF"
#F,"Recalculate "+C$
selected(wi%,15)
C$="ON"
C$="OFF"
#F,"BlankRecord "+C$
selected(wi%,16)
C$="ON"
C$="OFF"
#F,"MoveDescriptor "+C$
selected(wi%,21)
C$="ON"
C$="OFF"
#F,"Validate "+C$
selected(wi%,19)
C$="ON"
C$="OFF"
#F,"ShowLinked "+C$
selected(wi%,20)
C$="ON"
C$="OFF"
#F,"Warning "+C$
autosave%
0:C$="OFF"
1:C$="WARN"+$Interval%
2:C$="AUTO"+$Interval%
#F,"Autosave "+C$
autobalance%
:C$="OFF"
:C$="AUTO"+$Every%
#F,"Autobalance "+C$
selected(prefsW%,34)
C$="ON"
C$="OFF"
#F,"Duplication "+C$
selected(prefsW%,41)
C$="ON"
C$="OFF"
#F,"DefaultAction "+C$
selected(prefsW%,47)
C$="ON"
C$="OFF"
#F,"StripLeading "+C$
selected(prefsW%,42)
C$="ON"
C$="OFF"
#F,"StripTrailing "+C$
selected(prefsW%,43)
C$="ON"
C$="OFF"
#F,"RememberPlace "+C$
selected(prefsW%,48)
C$="ON"
C$="OFF"
#F,"SaveMarked "+C$
selected(prefsW%,44)
C$="ON"
C$="OFF"
#F,"AutoCSV "+C$
selected(prefsW%,49)
C$="ON"
C$="OFF"
#F,"AutoOpen "+C$
C$=$StartHere%
C$<>""
#F,"SaveStart "+C$
close_file(F)
"OS_File",18,f$,&fff
get_csv_options(f$)
F,S$,C$,P%
S$=
S$,1)<>"|"
- P%=
S$," "):C$=
S$,P%+1):S$=
S$,P%-1)
"Separator":
$Delim%=""
#
"Comma":sep$=",":P%=0
" "
"TAB":sep$=
(9):P%=1
"
"CR":sep$=
(13):P%=2
"
"LF":sep$=
(10):P%=3
%
$Delim%=C$:sep$=C$:P%=4
'
tick_one(delimiterM%,0,3,P%)
4 $
text(csvW%,14)=C$:
redraw_icon(csvW%,14)
"Terminator":
$Termin%=""
#
"CR":term$=
(13):P%=0
#
"LF":term$=
(10):P%=1
,
"CR LF":term$=
(13)+
(10):P%=2
,
"LF CR":term$=
(10)+
(13):P%=3
,
"CR CR":term$=
(13)+
(13):P%=4
,
"LF LF":term$=
(10)+
(10):P%=5
(
: $Termin%=C$:term$=C$:P%=6
(
tick_one(terminatorM%,0,5,P%)
4 $
text(csvW%,15)=C$:
redraw_icon(csvW%,15)
"ScrollTerm":
$Scrterm%=""
" .
"Semicolon":scrollterm$=";":P%=0
"!*
"Comma":scrollterm$=",":P%=1
"")
"TAB":scrollterm$=
(9):P%=2
"#*
"Space":scrollterm$=" ":P%=3
"$.
$Scrterm%=C$:scrollterm$=C$:P%=4
"&(
tick_one(scrolltermM%,0,3,P%)
"'4 $
text(csvW%,27)=C$:
redraw_icon(csvW%,27)
"(/
"Quotes":
set_icon(csvW%,0,C$="ON")
")/
"Header":
set_icon(csvW%,1,C$="ON")
"*/
"Blanks":
set_icon(csvW%,2,C$="ON")
"+,
"Key":
set_icon(csvW%,3,C$="ON")
",/
"RecNo":
set_icon(csvW%,22,C$="ON")
"-D
"Data":
set_icon(csvW%,4,(C$="ON"
selected(csvW%,1)))
".1
"Display":
set_icon(csvW%,11,C$="ON")
"//
"Strip":
set_icon(csvW%,16,C$="ON")
"00
"NewSeq":
set_icon(csvW%,23,C$="ON")
"1
shade(csvW%,4,(
selected(csvW%,1)))
close_file(F)
save_csv_options(f$)
F,C$
selected(csvW%,0)
C$="ON"
C$="OFF"
#F,"Quotes "+C$
selected(csvW%,1)
C$="ON"
C$="OFF"
#F,"Header "+C$
selected(csvW%,2)
C$="ON"
C$="OFF"
#F,"Blanks "+C$
selected(csvW%,3)
C$="ON"
C$="OFF"
#F,"Key "+C$
selected(csvW%,22)
C$="ON"
C$="OFF"
#F,"RecNo "+C$
selected(csvW%,4)
C$="ON"
C$="OFF"
#F,"Data "+C$
sep$
",":C$="Comma"
(9):C$="TAB"
(10):C$="LF"
(13):C$="CR"
:C$=sep$
#F,"Separator "+C$
term$
(13):C$="CR"
(10):C$="LF"
(13)+
(10):C$="CR LF"
(10)+
(13):C$="LF CR"
(13)+
(13):C$="CR CR"
(10)+
(10):C$="LF LF"
:C$=term$
#F,"Terminator "+C$
scrollterm$
";":C$="Semicolon"
",":C$="Space"
(9):C$="TAB"
:C$=scrollterm$
#F,"ScrollTerm "+C$
selected(csvW%,11)
C$="ON"
C$="OFF"
#F,"Display "+C$
selected(csvW%,16)
C$="ON"
C$="OFF"
#F,"Strip "+C$
selected(csvW%,23)
C$="ON"
C$="OFF"
#F,"NewSeq "+C$
close_file(F)
"OS_File",18,f$,&fff
load_indexes
f$,menu$,R4%,ptr%
"l*f$=$database%+".Indexes":R4%=0:Keys%=0
menu$="indexes,"
R4%<>-1
Keys%+=1
"p4
"OS_GBPB",9,f$,block%,1,R4%,255
,,K$,,R4%
R4%<>-1
hidden%=
"s&
load_index(f$+"."+K$,Keys%,
"t2
hide%?KF%(Keys%,0)<>1
colour(Keys%,2)
"w Keys%-=1:
colour(0,1):key%=0
extrakeys$<>""
softerror(
(MaxKeys%)+",subsidiary indexes,"+
extrakeys$)+",Keys",96)
make_index_menu
load_index(f$,key%,merge%)
keybase%,I%,name$
leaf(f$),3)="Del"
Keys%-=1:
key%>MaxKeys%
merge%
extrakeys$+=
leaf(f$)+",":Keys%-=1:
"OS_File",5,f$
,,,,len%
name$=
leaf(f$)
FSHkeyptr%(key%)=
extend_named_sliding_block(keyanchor%(key%),len%)
keybase%=SHkeyptr%(key%)
"OS_File",255,f$,keybase%
Index$(key%)=name$
key%=0
I%=0
% $Date%(I%)=$(keybase%+8+9*I%)
KL%(key%)=keybase%?70
I%=0
& KW%(key%,I%)=!(keybase%+74+I%*4)
+ KF%(key%,I%)=(KW%(key%,I%)>>24)
!case%(key%)=(keybase%?71=255)
%incspace%(key%)=(keybase%?72=255)
!null%(key%)=(keybase%?73=255)
keybase%!62>0
### Old key structure applies ###
words%=
I%=0
KW%(key%,I%)>0
" KF%(key%,I%)=keybase%!62
K KW%(key%,I%)=!(keybase%+74+I%*4)+((I%+1)<<16)+((keybase%!62)<<24)
words%=
words%
KF%(key%,0)=keybase%!62:KW%(key%,0)=KL%(key%)+((keybase%!62)<<24)
keybase%!66>0
I%=1
KW%(key%,I%)>0
$ KF%(key%,I%)=keybase%!66
I KW%(key%,I%)=!(keybase%+74+I%*4)+(I%<<16)+((keybase%!66)<<24)
load_user_functions(f$)
func$,d%,R4%
"OS_File",5,f$+".UserFuncs"
f$+".UserFuncs"
"OS_File",8,f$+".xyzzy"
"OS_CLI","Rename "+f$+".UserFuncs "+f$+".xyzzy.UserFuncs"
"OS_CLI","Rename "+f$+".xyzzy "+f$+".UserFuncs"
f$+=".UserFuncs"
9
"OS_GBPB",9,f$,block%,1,R4%,255
,,func$,,R4%
#
R4%<>-1
f$+"."+func$
R4%=-1
get_tables
F,F%,d%,R4%,f$,file$,name$,subst%,field%,exact%,scrcol%,type%,err%
%f$=$database%+".ValTables.":R4%=0
lit(validateM%,0,
($database%+".Link")
F>0
!block%=mainW%
F%+=1
#F,link$(F%)
name$=link$(F%)
name$,1)="@"
chartype%(F%)
9
35:$
val(mainW%,field%(F%))="R5;Sdirectory"
file$=
name$,2)
0 file$=
filename(file$,"PrintRes",-1)
2
"XOS_File",5,file$
d%,,type%;err%
(err%
1)=1
link$(F%)=""
A
softerror(file$+","+
leaf(file$)+","+Tag$(F%),121)
d%=1
' type%=(type%>>8)
&fff
> $
val(mainW%,field%(F%))="R5;Sfile_"+
~(type%)
/ field%=
trailing_number(name$,exact%)
name$<>""
1 subst%=
leading_number(scrcol%,name$)
(
"OS_File",5,f$+name$
d%=1
%
load_table(f$+name$,
scrcol%>0
5
colour_scroller(F%,scrcol%,fcol%(8))
<
set_icon_cols(mainW%,field%(F%),fcol%(8))
$
softerror(name$,31)
link$(0)="LOADED"
close_file(F)
### Force loading of unlinked but flagged tables ###
### The use of "!" to flag tables sometimes gives an error. Use "+" ###
R4%<>-1
"OS_GBPB",9,
f$),block%,1,R4%,255
,,name$,,R4%
R4%<>-1
name$)
+
"+","!":
load_table(f$+name$,
T%=LastTable%+1
MaxTabs%
A SHtabptr%(T%)=
extend_named_sliding_block(tabanchor%(T%),4)
extratabs$<>""
softerror(
(MaxTabs%)+",tables,"+
extratabs$)+",Tabs",96)
make_table_menu(TabsLoaded$)
load_calcs
F,I%,F%,F1%,P%,calc$,file%,top
update$()=""
($database%+".Calc")
F>0
+ F%+=1:F$=
~(F%):
F%<16
F$="0"+F$
!
#F,calc$:calc$(F%)=calc$
chartype%(F%)
6,7:
! P%=
calc$,"$Rf%(",P%)
?
P%>0
F1%=
calc$,P%+5)):update$(F1%)+=F$:P%+=5
P%=0
P%=
calc$,"FNn(",P%)
?
P%>0
F1%=
calc$,P%+4)):update$(F1%)+=F$:P%+=4
P%=0
.
calc$,"TIME$")>0
update$(0)+=F$
calc$(0)="LOADED"
close_file(F)
selected(prefsW%,14)
, dbasehandle%=
($database%+".Database")
"Hourglass_On"
file%=0
top=8*file%+LH%
! P%=
neighbour(key%,top,1)
P
update$(0)<>""
updatethese%=
scan_file("P%<>top",key%,file%,6,1)
file%
"Hourglass_Off"
close_file(dbasehandle%)
I%=1
fields%
chartype%(I%)
$
21,27,28,32,34,40,45,59:
# O
$Rf%(I%) holds key legend or other important data. Don't overwrite!
:$Rf%(I%)=field$(I%)
redraw(mainW%)
field_data
print_init("W")
I%,V%,tab%,S$,M$,M%,P%
#+DTextName$=$database%+".PrintJobs.FieldData":$SaveName%=TextName$
#,7format$="fields":LenLine%=Lmargin%+93:tab%=Lmargin%
spacer$,"|")>0
spacer$="|"
Tab%()=0,1,7,23,43,47,52,57
#/8maxhead%=0:fspace%=18:hspace%=3*36-18:PrintFields%=6
end_line
send_title("Description of fields")
send_title("Field Class Type Len Tag Descriptor")
M$="ECTXKOSL"
"Hourglass_On"
I%=1
fields%
#89 S$=
" "+
(I%),4):
store_string(S$,tab%,
):tab%+=6
#9? V%=chartype%(I%):M%=
M$,vtype$(V%))-1:P%=
fmenu$(M%),",")
#:6
store_string(
fmenu$(M%),P%-1),tab%,
):tab%+=16
#;% S$=
(V%),2)+" "+vname$(V%)
#<'
store_string(S$,tab%,
):tab%+=20
#=> S$=
" "+
(len%(I%)),3):
store_string(S$,tab%,
):tab%+=4
#>,
store_string(Tag$(I%),tab%,
):tab%+=5
#?4
store_string($
text(mainW%,desc%(I%)),tab%,
tab%=Lmargin%
"Hourglass_Off"
nosort%=
screen_list
write_log(-1,"Field data printed","")
get_form(
Fptr%)
F,L%,N%,I%,V%,x%,y%,xlim%,ylim%,text%,width%,nwidth%,resave%,num%,Ex%
design%
dval%=hand%
dval%=-1
($database%+".Form")
F>0
#NB SHformptr%=
extend_named_sliding_block(formanchor%,SHclaim%)
#F,N%
#PB
N%>127
close_file(F):
fatal_err%,
msg("Err207,"+
(N%))
#Qd
N%>MaxFields%
close_file(F):
fatal_err%,
msg("Err98,"+
(N%)+","+
(MaxFields%)+",Fields")
#R7 Fptr%=SHformptr%:Rf%(0)=Fptr%:$Rf%(0)="":Fptr%+=1
Length%=0
I%=1
#U@
#F,Desc$,Tag$(I%),xd%,yd%,xf%,yf%,len%,char%,fix%,bbox%
#V3
(char%
128)>0
hide%?I%=1
hide%?I%=0
#W=
(char%
256)>0
mandatory%?I%=1
mandatory%?I%=0
#XA
(char%
512)>0
displayit%?I%=1
displayit%?I%=0
#Y.
char%>67
char%<79
updatethese%=
char%=char%
#[0
len%=0
dbtype$="new"
zerolen%?I%=1
#]B
hide%?I%=1:dflg%=(winback%<<28)+(winback%<<24)+&01A711
#^2
Desc$="":dflg%=(winback%<<28)+&701A711
#_)
:dflg%=(winback%<<28)+&701A731
#`
#a. width%=bbox%
&FFFF:height%=bbox%>>16
len%>0
#c,
height%=0
height%=48:resave%=
#d2
width%=0
width%=len%*16+16:resave%=
$boxW%=
(width%)
#gG
### Following IF...THEN corrects for desktop font changes ###
#h,
FontAdjust%
vtype$(char%)<>"L"
#i1 nwidth%=
guess_width(len%,char%,width%)
#j:
len%>0
(nwidth%-width%)<80
width%=nwidth%
#k
#l>
design%
fval%=hvalid%(char%)
fval%=valid%(char%)
#m" x%=xf%+width%+32:y%=yf%-16
x%>xlim%
xlim%=x%
y%<ylim%
ylim%=y%
#p' y%=yd%-16:
y%<ylim%
ylim%=y%
#q)
zerolen%?I%=0
Length%+=len%+1
#rF
design%=
char%=39
len%=(height%
40)*((width%
16)-4)
#s7 len%(I%)=len%:chartype%(I%)=char%:fix%(I%)=fix%
L%=
(Desc$)
#uF SHformptr%=
claim_page(formanchor%,Fptr%-SHformptr%+L%+len%+2)
$Fptr%=Desc$
#w$ dwidth%=
string_width(Desc$)
#xK
yd%>=yf%
yd%+44<=yf%+height%
xd%<xf%
xd%=xf%-dwidth%
#yU desc%(I%)=
create_icon(0,mainW%,xd%,yd%,dwidth%,44,dflg%,"",Fptr%,dval%,L%+1)
#z- Fptr%+=L%+1:Rf%(I%)=Fptr%:$Rf%(I%)=""
#{0
char%=35
char%=44
len%=NameLength%
char%
#}@
59:fval%=SHlogoptr%:$Fptr%=Tag$(I%):len%=
(Tag$(I%))
#~j
9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31:buttonfield%(0,char%-9)=I%
!
check_menu_button
35,44,60,61,62:
V%=valid%(char%):L%=30
C SHformptr%=
claim_page(formanchor%,Fptr%-SHformptr%+L%+2)
F fval%=Fptr%:$fval%=$V%:Fptr%+=L%+1:Rf%(I%)=Fptr%:$Rf%(I%)=""
5
char%=60
Fptr%+=len%+1:$Fptr%="":len%=0
M field%(I%)=
icon_design(I%,char%,xf%,yf%,width%,height%,fval%,len%,
char%
.
3,6,46,47,54,56,57,74,75,77,78,79:
1
icon_bit(9,mainW%,field%(I%),
):num%=
(
Right-justify numeric fields
3
64,65,66,67:
rename_directory(I%,char%)
L
make_scroller(Scrollnum%,I%,xf%,yf%,width%,height%,len%,char%-63)
6
36,37,38,39,40:
rename_directory(I%,char%)
close_file(F)
numericfields%=0
set_up_select(N%,numericfields%)
N%=0
7!block%=0:block%!4=ylim%:block%!8=xlim%:block%!12=0
"Wimp_SetExtent",mainW%,block%
JTag$(0)="RECORD":Tag$(MaxFields%+1)="KEY":Tag$(MaxFields%+2)="SUBFILE"
resave%
fields%=N%:
save_form($database%+".Form")
Scrollnum%>MaxLists%
Scrollnum%=MaxLists%:
fatal_err%,
msg("Err32,"+
(Scrollnum%)+",scrollable lists,"+
(MaxLists%)+",Scrolls")
Ex%>0
save_renamed(Ex%)
check_menu_button
(Tag$(I%))
Tag$(I%)="":Tag$(I%)=Tag$(I%-1):resave%=
F%>0:Tag$(I%)=Tag$(F%):resave%=
Assume button already has same tag as menufield
save_renamed(N%)
"OS_CLI","Copy <Pbase$Dir>.Resources.RevertInfo "+$database%+".!Help ~C~V"
"rename%=
($database%+".!Help")
#rename%=
#rename%
#revert%=
($database%+".Revert")
#revert%,"Set Dbase$Dir <Obey$Dir>"
I%=0
N%-1
#rename%,Label$(I%,0)
#revert%,Label$(I%,1)
#revert%,"Remove <Dbase$Dir>.!Help"
#revert%,"Remove <Dbase$Dir>.Revert"
close_file(rename%)
close_file(revert%)
"OS_File",18,$database%+".Revert",&feb
Label$()=""
softerror(
leaf($database%)+".!Help",215)
rename_directory(F%,type%)
type%
36,39:old$="Memo"+
(F%):new$=Tag$(F%)+"text"
37,40:old$="Sprite"+
(F%):new$=Tag$(F%)+"sprite"
38:old$="Draw"+
(F%):new$=Tag$(F%)+"draw"
64,65,66,67:old$="Scroll"+
(F%):new$=Tag$(F%)+"scroll"
"OS_File",5,$database%+"."+new$
d%=2
"OS_File",5,$database%+"."+old$
d%=2
"OS_CLI","Rename "+$database%+"."+old$+" "+$database%+"."+new$
- Label$(Ex%,0)=old$+" renamed as: "+new$
C Label$(Ex%,1)="Rename <Dbase$Dir>."+new$+" <Dbase$Dir>."+old$
Ex%+=1
### Routines to handle scrollable-list fields (types 64,65,66,67) ###
### Databases using such fields are incompatible with earlier versions ###
make_scroller(
N%,F%,x%,y%,w%,h%,L%,cols%)
N%>=MaxLists%
N%+=1:
handle%,rows%,I%,J%,R%,colwidth%,F,max%,pos%
"Wimp_OpenTemplate",,"<Pbase$Dir>.Resources.Templates"
#handle%=
new_window("scroll",0)
"Wimp_CloseTemplate"
LSHscrollptr%(N%)=
extend_named_sliding_block(scrollanchor%(N%),SHclaim%)
'f$=$database%+"."+Tag$(F%)+"scroll"
"OS_File",8,f$
scrollerW%(N%)=handle%
scrolldata%(N%,0)=F%
scrolldata%(N%,1)=x%
scrolldata%(N%,2)=y%
scrolldata%(N%,3)=w%
scrolldata%(N%,4)=h%
rows%=(h%
Cscrolldata%(N%,5)=rows%*cols%:
No.of icons in window initially
Hscrolldata%(N%,6)=scrolldata%(N%,5):
No.of icons for current record
(f$+".Max")
F>0
scrolldata%(N%,7)=
scrolldata%(N%,7)=scrolldata%(N%,5):
Max.No.of icons for database
close_file(F)
scrolldata%(N%,8)=cols%
scrolldata%(N%,9) holds Tab number for printing
ptr%=SHscrollptr%(N%)
(f$+".Format")
I%=0
cols%-1
F>0
sclen%(N%,I%)=
sclen%(N%,I%)=10
max%+=sclen%(N%,I%)+1
close_file(F)
I%=1
rows%
pos%=0
J%=0
cols%-1
L%=sclen%(N%,J%)
) colwidth%=((w%-44)*(L%+1))
max%
( flags%=&0000A535+(fcol%(10)<<24)
g R%=
create_icon(0,handle%,pos%,-I%*44-2,colwidth%,46,flags%,"",ptr%,valid%(chartype%(F%)),L%+1)
pos%+=colwidth%
$
text(handle%,R%)=""
ptr%+=L%+1
(f$+".Blank")
I%=0
scrolldata%(N%,5)-1
#F,""
close_file(F)
$Reformatted%<>""
"OS_CLI","Copy "+$Original%+"."+Tag$(F%)+"scroll.Format "+f$+".Format ~V~CF"
7!block%=0:block%!4=-h%+2:block%!8=w%-44:block%!12=0
"Wimp_SetExtent",handle%,block%
N%+=1
colour_scroller(field%,column%,colour%)
S%,ic%,wi%,icons%,cols%
column%=0
7colour%=(colour%
%1111)
(fcol%(10)
%11110000)
scroller_number(field%):wi%=scrollerW%(S%)
icons%=scrolldata%(S%,6)
cols%=scrolldata%(S%,8)
ic%=0
icons%-1
ic%
cols%=column%-1
'
set_icon_cols(wi%,ic%,colour%)
+
set_icon_cols(wi%,ic%,fcol%(10))
add_row(S%,wi%,from%,cols%)
F%,I%,L%,N%,R%,colwidth%,pos%,w%,max%,valcol%,ptr%,flags%,table$
$flags%=&0000A535+(fcol%(10)<<24)
F%=scrolldata%(S%,0)
table$=link$(F%)
leading_number(valcol%,table$)
&!block%=mainW%:block%!4=field%(F%)
"Wimp_GetIconState",,block%
w%=block%!16-block%!8
I%=0
cols%-1
max%+=sclen%(S%,I%)+1
ptr%=(from%-1)*max%
=SHscrollptr%(S%)=
claim_page(scrollanchor%(S%),ptr%+max%)
I%=0
cols%-1
L%=sclen%(S%,I%)+1
$"# colwidth%=((w%-44)*L%)
max%
$#s R%=
create_icon(0,wi%,pos%,-from%*44-2,colwidth%,46,flags%,"",SHscrollptr%(S%)+ptr%,valid%(chartype%(F%)),L%)
pos%+=colwidth%
$%6
I%=valcol%-1
set_icon_cols(wi%,R%,fcol%(8))
text(wi%,R%)=""
ptr%+=L%
$(1
selected(wi%,R%-cols%)
select(wi%,R%)
scrolldata%(S%,6)+=cols%
scrolldata%(S%,6)>scrolldata%(S%,7)
scrolldata%(S%,7)=scrolldata%(S%,6)
$,=!block%=0:block%!4=-from%*44-2:block%!8=w%-44:block%!12=0
"Wimp_SetExtent",wi%,block%
=scrolldata%(S%,6)
delete_row(S%,wi%,cols%,F%)
ic%,icons%,flag%,w%,rows%
icons%=scrolldata%(S%,6)
icons%=scrolldata%(S%,5)
=icons%
ic%=icons%-cols%
icons%-1
$5%
text(wi%,ic%)<>""
flag%=
flag%
icons%-=cols%
delete_icons(wi%,icons%)
scrolldata%(S%,6)=icons%
rows%=icons%
cols%
$<( !block%=mainW%:block%!4=field%(F%)
$=$
"Wimp_GetIconState",,block%
w%=block%!16-block%!8
$?? !block%=0:block%!4=-rows%*44-2:block%!8=w%-44:block%!12=0
$@$
"Wimp_SetExtent",wi%,block%
$A
set_caret(0,wi%,icons%-1)
scroll_it(wi%,rows%-1,
redraw(wi%)
=icons%
scroller_click(swi%,sic%,b%,S%)
validate(Fieldnumber%,T%,N$)=
b%=(b%
2047)
$K,wi%=mainW%:ic%=field%(scrolldata%(S%,0))
identify_field(ic%)
$M(Scrcol%=(sic%
scrolldata%(S%,8))+1
first%=
find_caret
$Q*
select_range(first%,Fieldnumber%,
$S(
selected(passW%,11)
Modify%
set_up_field_menu
$U#
show_menu(mainM%,x%-64,y%)
relations
$X:
64:dragfield%=Fieldnumber%:
init_drag(swi%,sic%,5)
$YE
256:
invert(wi%,ic%):
update_selection(
selected(wi%,ic%),"")
$Z"
I%=0
scrolldata%(S%,6)-1
$[-
set_icon(swi%,I%,
selected(wi%,ic%))
1024:
(-2)
$_5
enter_tag(Tag$(Fieldnumber%)+"#"+
(Scrcol%))
$`
$a5 !block%=swi%:
"Wimp_GetWindowState",,block%
$bW
Access%
"Wimp_SetCaretPosition",swi%,sic%,x%-block%!4+block%!20,y%,-1,-1
$c,
selected(prefsW%,19)
relations
scroller_press(wi%,
ic%,S%,pressed%)
L%,cols%,P%,icons%,row%,col%,ok%
abort_scroller:
ok%=-1
$m"Fieldnumber%=scrolldata%(S%,0)
icons%=scrolldata%(S%,6)
cols%=scrolldata%(S%,8)
row%=(icons%
cols%)+1
col%=ic%
cols%
L%=len%(Fieldnumber%)
cfield$(Fieldnumber%)="#"
pressed%
$u<
13,398,399,414,415:ok%=
validate(Fieldnumber%,T%,N$)
ok%=0
pressed%
$y$
select_range(1,fields%,
sclen%(S%,col%)>=10
$|( $
text(wi%,ic%)=
convert_date(4)
$}A
sclen%(S%,col%)>=8
text(wi%,ic%)=
convert_date(2)
redraw_icon(wi%,ic%)
sclen%(S%,col%)>=8
T$=
-
T$,3,1)=$timesep%:
T$,6,1)=$timesep%
$
text(wi%,ic%)=T$
redraw_icon(wi%,ic%)
21:ScrollChanged%=
clear_selection:
restore_caret(starthere%)
* changed%=
update_calcs(Fieldnumber%)
ic%
icons%-1:
(-1)
3 icons%=
add_row(S%,wi%,row%,cols%):ic%+=1
0
set_caret(0,wi%,ic%):row%=ic%
cols%
scroll_it(wi%,row%,
(
Fieldnumber%=Lastwritable%
#
close_window(relateW%)
ScrollChanged%=
/
check_record
display(key%,-1)
9
Fieldnumber%=
next_editable(Fieldnumber%,1)
ic%+=1
.
set_caret(0,wi%,ic%):row%=ic%
cols%
scroll_it(wi%,row%,
selected(prefsW%,19)
relations
398,414:
* changed%=
update_calcs(Fieldnumber%)
ic%=icons%-1
3 Fieldnumber%=
next_editable(Fieldnumber%,1)
.
pressed%=398
ic%+=cols%
ic%+=1
!
ic%>icons%-1
ic%=col%
.
set_caret(0,wi%,ic%):row%=ic%
cols%
scroll_it(wi%,row%,
selected(prefsW%,19)
relations
399,415:
* changed%=
update_calcs(Fieldnumber%)
ic%=0
4 Fieldnumber%=
next_editable(Fieldnumber%,-1)
.
pressed%=399
ic%-=cols%
ic%-=1
'
ic%<0
ic%=icons%-cols%+col%
.
set_caret(0,wi%,ic%):row%=ic%
cols%
scroll_it(wi%,row%,
selected(prefsW%,19)
relations
461:icons%=
add_row(S%,wi%,row%,cols%):
Insert at end (Ins)
477:
Delete last row if blank (
D icons%=
delete_row(S%,wi%,cols%,Fieldnumber%):ScrollChanged%=
493:
Insert blank after row with caret (^Ins)
ic%
cols%>0
ic%-=1
( icons%=
add_row(S%,wi%,row%,cols%)
I%=icons%-1
ic%+cols%
+ $
text(wi%,I%)=$
text(wi%,I%-cols%)
I%=ic%
ic%+cols%-1
$
text(wi%,I%)=""
redraw(wi%)
ScrollChanged%=
509:
Delete row with caret, incl. data (^
ic%
cols%>0
ic%-=1
I%=ic%
icons%-cols%-1
+ $
text(wi%,I%)=$
text(wi%,I%+cols%)
I%=icons%-cols%
icons%-1
$
text(wi%,I%)=""
3 icons%=
delete_row(S%,wi%,cols%,Fieldnumber%)
set_caret(0,wi%,ic%)
redraw(wi%)
ScrollChanged%=
pressed%>31
pressed%<384
ScrollChanged%=
2
main_press(mainW%,field%(Fieldnumber%))
scroll_it(wi%,row%,end%)
scrollrow%,lastrow%
0!block%=wi%:
"Wimp_GetWindowState",,block%
scrollrow%=-(block%!24
3lastrow%=((block%!16-block%!8)
44)+scrollrow%
row%=lastrow%:block%!24-=44:
"Wimp_OpenWindow",,block%
row%<scrollrow%
end%=
5 block%!24=-row%*44:
"Wimp_OpenWindow",,block%
get_scroller(R%,F%,cols%)
b$,S%,L%
$Rf%(F%)=
scroller_number(F%)
blob_path(
,$database%,R%,F%,64,b$)
L%<0
"OS_CLI","Copy "+$database%+"."+Tag$(F%)+"scroll.Blank "+b$+" ~C~V"
import_to_scroller(S%,b$)
import_to_scroller(S%,f$)
L%,N%,I%,F,P%,icons%,micons%,fields%,lastrow%,delfrom%,wi%
abort_scroller:
wi%=scrollerW%(S%)
F%=scrolldata%(S%,0)
Vicons%=scrolldata%(S%,6):
Currently available no.of icons. May need more or fewer
Hmicons%=scrolldata%(S%,5):
Minimum no.of icons. Must not have fewer
cols%=scrolldata%(S%,8)
I%=1
cols%
;
text(wi%,fields%)=
#F,sclen%(S%,I%-1))
fields%+=1
fields%=icons%
! lastrow%=icons%
cols%
2 icons%=
add_row(S%,wi%,lastrow%+1,cols%)
close_file(F)
fields%<micons%:delfrom%=micons%:fields%=icons%
fields%<icons%:delfrom%=fields%
delfrom%>0
% !
delete_icons(wi%,delfrom%)
icons%=fields%
scrolldata%(S%,6)=icons%
lastrow%=fields%
cols%
2 !block%=wi%:
"Wimp_GetWindowState",,block%
! block%!8=block%!12-block%!4
3 !block%=0:block%!4=-lastrow%*44-2:block%!12=0
"Wimp_SetExtent",wi%,block%
scroll_it(wi%,0,
redraw(wi%):
redraw(wi%)
ScrollChanged%=
abort_scroller
close_file(F)
wimp_error(
redraw(wi%)
Returns max possible space needed
max_scroller_length(S%,F%,cols%,scrcol%,L%)
I%,rows%,max%
%!#rows%=scrolldata%(S%,7)
cols%
I%=1
rows%
%#? max%+=
max_row_length(S%,F%,cols%,scrcol%,L%)+
(rowterm$)
=max%-
(rowterm$)
max_row_length(S%,F%,cols%,scrcol%,explen%)
I%,max%
I%=1
cols%
%*4
I%=scrcol%
L%=explen%
L%=sclen%(S%,I%-1)
max%+=L%+
(cellsep$)
=max%-
(cellsep$)
read_scroller_row(R%,F%,S%,cols%,sh%,s$)
L%,LF%,LR%,F$,S$,F,J%,scrcol%
"OS_Byte",229,1:
"OS_Byte",124
%2+L%=
blob_path(
,$database%,R%,F%,64,b$)
L%>0
scrcol%=scrcol%(S%)
#F=scroller_ptr%(S%)
J%=1
cols%
J%=cols%
s$=""
F$=
F$<>""
J%=scrcol%
%<3 F$=
expand(F$,link$(F%),L%,SF$,scrcol%)
%=
L%=sclen%(S%,J%-1)
flag%=
%@0
sh%
S$+=F$+s$
S$+=
pad(F$,L%)+s$
%A
scroller_ptr%(S%)=0
pending%(S%)=
%F
scroller_ptr%(S%)=
remaining%=
close_file(F)
pending%(S%)=
"OS_Byte",229,0
print_rest_of_scrollers(R%)
Prints remaining parts of scrollable lists in Horizontal format
S%,F%,T%,cols%,F$,remaining%,flag%,L%
remaining%=
:flag%=
S%=0
Scrollnum%-1
pending%(S%)
F%=scrolldata%(S%,0)
%X! cols%=scrolldata%(S%,8)
N%=scrolldata%(S%,9)
%Z: F$=
read_scroller_row(R%,F%,S%,cols%,
,cellsep$)
%[&
store_string(F$,Tab%(N%),
adjust_width
%]
%_,
flag%
store_rec_num(R%):
end_line
remaining%=
format$<>"table"
finish_scroller_printing(R%,F%,S%,cols%,pos%)
Prints scrollable list in Vertical format
F$,flag%
flag%=
%i6 F$=
read_scroller_row(R%,F%,S%,cols%,
,cellsep$)
flag%
end_line
store_rec_num(R%)
%m
store_string(F$,pos%,
%n
pending%(S%)=
write_scroller(R%,F%)
b$,L%,S%,I%,F,wi%
adjust%
scroller_number(F%)
wi%=scrollerW%(S%)
%w+L%=
blob_path(
,$database%,R%,F%,64,b$)
I%=0
scrolldata%(S%,6)-1
text(wi%,I%)
close_file(F)
"OS_File",18,b$,&fff
scroller_number(F%)
S%<Scrollnum%-1
scrolldata%(S%,0)<>F%
S%+=1
scroller_num2(wi%)
S%<Scrollnum%-1
wi%<>scrollerW%(S%)
S%+=1
kill_scrollers(permanent%)
F%,S%,F,f$
S%=Scrollnum%
S%>0
S%-=1
scroll_it(scrollerW%(S%),0,
close_window(scrollerW%(S%))
adjust%
$Reformatted%=""
F%=scrolldata%(S%,0)
/ f$=$database%+"."+Tag$(F%)+"scroll.Max"
F=
(scrolldata%(S%,7))
close_file(F)
"OS_File",18,f$,&fff
permanent%
Scrollnum%=0
inscroll(F%,col%,s$,op$,val%)
len%,found%,cell$,case%,F,N%,cols%,S$
/len%=
blob_path(
,$database%,REC%,F%,64,b$)
cols%=chartype%(F%)-63
case%=
selected(queryW%,1)
cell$=
N%+=1:
N%>cols%
N%=1
N%=col%
col%=0
#
case%
cell$=
u(cell$)
op$
%
"{":found%=(
cell$,s$)>0)
&
"}{":found%=(
cell$,s$)=0)
$
"$":found%=
wc(cell$,s$)
,
":found%=
wc(cell$,s$)
val%
&
:S$="VAL(cell$)"+op$+s$
+
:S$="cell$"+op$+""""+s$+""""
found%=
found%
close_file(F)
=found%
### End of scrollable-list routines ###
get_winpos
F,x%,y%,w%,h%,xs%,ys%,ic%
design%
( w%=ScreenWidth%*2:h%=MaxFields%*64
x%=0:y%=0:xs%=0:ys%=0
4 !block%=0:block%!4=-h%:block%!8=w%:block%!12=0
"Wimp_SetExtent",mainW%,block%
position_window(mainW%,x%,y%,w%,h%,xs%,ys%)
($database%+".Winpos")
F=0
7 !block%=mainW%:
"Wimp_GetWindowState",,block%
/
position_window(mainW%,200,-1,0,0,0,0)
K
ShowTools%
Tools%=1
position_window(keypadW%,100,50,0,0,0,0)
#F,x%,y%,w%,h%,xs%,ys%
4
position_window(mainW%,x%,y%,w%,h%,xs%,ys%)
ShowTools%
Tools%
#
#F,x%,y%,w%,h%,xs%,ys%
:
position_window(keypadW%,x%,y%,w%,h%,xs%,ys%)
9
position_window(keypadW%,100,50,0,0,0,0)
close_file(F)
save_winpos
$database%,4)="CDFS"
($database%+".Winpos")
save_window(mainW%)
Tools%=1
save_window(keypadW%)
#F,650,400,658,316,0,0
close_file(F)
save_window(handle%)
x%,y%,w%,h%,xs%,ys%,ic%
4!block%=handle%:
"Wimp_GetWindowState",,block%
;x%=block%!4:y%=block%!8:w%=block%!12-x%:h%=block%!16-y%
xs%=block%!20:ys%=block%!24
#F,x%,y%,w%,h%,xs%,ys%
position_window(wi%,x%,y%,w%,h%,xs%,ys%)
wi%
matchW%,savesubW%:
shade(queryW%,4,
default_query
changeW%,moveW%,filterW%:
shade(queryW%,4,
default_query
"Wimp_GetCaretPosition",,block%
0!block%=wi%:
"Wimp_GetWindowState",,block%
w%=0
w%=block%!12-block%!4
h%=0
h%=block%!16-block%!8
0:x%=(ScreenWidth%-w%)
-1:x%=block%!4
0: y%=(ScreenHeight%-h%)
-1:y%=block%!8
block%!4=x%:block%!12=x%+w%
block%!8=y%:block%!16=y%+h%
block%!20=xs%:block%!24=ys%
block%!28=-1
"Wimp_OpenWindow",,block%
open_it(wi%)
default_query
f$,d%
$f$=$database%+".PrintRes.!Query"
"OS_File",5,f$
d%=1
"OS_File",255,f$,Query%
$Query%=""
open_at(
flag%,wi%,butt%,ww%,wh%,iw%,ih%)
x%,y%,vxmin%,vymax%,scrollx%,scrolly%
flag%
5 !block%=mainW%:
"Wimp_GetWindowState",,block%
L vxmin%=block%!4:vymax%=block%!16:scrollx%=block%!20:scrolly%=block%!24
Z !block%=mainW%:block%!4=field%(buttonfield%(0,butt%)):
"Wimp_GetIconState",,block%
? x%=block%!16-scrollx%+vxmin%:y%=block%!20-scrolly%+vymax%
2 !block%=wi%:
"Wimp_GetWindowState",,block%
6 block%!4=x%-(ww%+iw%)
2:block%!12=block%!4+ww%
6 block%!8=y%-(wh%+ih%)
2:block%!16=block%!8+wh%
block%!28=-1:
open_it(wi%)
flag%=
open_window(wi%)
set_up_select(fields%,
rows%)
S$,I%,J%,Fptr%
&&ASHselectptr%=
extend_named_sliding_block(selanchor%,SHclaim%)
Fptr%=SHselectptr%
I%=1
fields%
&)= SHselectptr%=
claim_page(selanchor%,Fptr%-SHselectptr%)
chartype%(I%)
&+.
3,6,8,46,47,54,56,57,74,75,77,78,79:
&," rows%+=1:
lit(printM%,5,
&-W handle%=
create_icon(0,numscrollW%,0,-rows%*48,144,48,&17000531,"",Fptr%,-1,15)
&.9 S$=$
text(mainW%,desc%(I%)):
(S$)>8
S$,8)
&/$ $Fptr%=S$:Fptr%+=
($Fptr%)+1
&0Y handle%=
create_icon(0,numscrollW%,140,-rows%*48,100,48,&17000531,"",Fptr%,-1,15)
&1* $Fptr%=Tag$(I%):Fptr%+=
($Fptr%)+1
J%=0
&3b handle%=
create_icon(0,numscrollW%,240+J%*88,-rows%*48,44,44,&0740B13B,"",Fptr%,tick%,1)
$Fptr%="":Fptr%+=1
calcrow%?I%=rows%
:calcrow%?I%=0
&:"!block%=0:block%!4=-rows%*48-4
block%!8=740:block%!12=0
"Wimp_SetExtent",numscrollW%,block%
enable_row(R%,on%)
R%>0
I%=R%*8-6
R%*8-1
&C"
shade(numscrollW%,I%,on%)
&D+
on%
deselect(numscrollW%,I%)
save_form(f$)
F,I%,xd%,yd%,xf%,yf%,w%,h%,bbox%,char%,dicon%,ficon%,Desc$
fields%=0
Length%=0
!block%=mainW%
#F,fields%
I%=1
fields%
char%=chartype%(I%)
char%=39
len%(I%)=0
&S( dicon%=desc%(I%):ficon%=field%(I%)
&T4 block%!4=dicon%:
"Wimp_GetIconState",,block%
&U xd%=block%!8:yd%=block%!12
Desc$=$(block%!28)
&W4 block%!4=ficon%:
"Wimp_GetIconState",,block%
&X xf%=block%!8:yf%=block%!12
&Y2 w%=block%!16-block%!8:h%=block%!20-block%!12
bbox%=(h%<<16)+w%
&[&
hide%?I%=1
char%=char%
&\+
mandatory%?I%=1
char%=char%
&]+
displayit%?I%=1
char%=char%
&^F
#F,Desc$,Tag$(I%),xd%,yd%,xf%,yf%,len%(I%),char%,fix%(I%),bbox%
&_8
len%(I%)>0
dbtype$="old"
Length%+=len%(I%)+1
field$(I%)=""
close_file(F)
"OS_File",18,f$,&7f2
lit(iconbarM%,3,
make_empty_index(RA%,key%,Z%)
I%,K%,P%,KLM%,S$
"Hourglass_On"
KL%(key%),".")
KLM%=KL%(key%)+13
P%=LH%+48+(RA%+1)*KLM%
SHkeyptr%(key%)=
extend_named_sliding_block(keyanchor%(key%),P%)
keybase%=SHkeyptr%(key%)
keybase%!0=138
keybase%!4=
($Increment%)
$date%=
(1)):
date(key%)
keybase%!62=0:keybase%!66=0
keybase%?70=KL%(key%)
&tCkeybase%?71=
selected(keyW%,30):case%(key%)=
selected(keyW%,30)
&uGkeybase%?72=
selected(keyW%,35):incspace%(key%)=
selected(keyW%,35)
&vCkeybase%?73=
selected(keyW%,37):null%(key%)=
selected(keyW%,37)
I%=0
&x( !(keybase%+74+(I%*4))=KW%(key%,I%)
I%=0
P%=I%*8+LH%
!(keybase%+P%)=-P%
!(keybase%+P%+4)=P%
P%=!keybase%
I%=0
RA%-1
"Hourglass_Percentage",(I%*100)
!(keybase%+P%)=P%+KLM%
!(keybase%+P%+4)=0
$(keybase%+P%+8)=S$
# !(keybase%+P%+KL%(key%)+9)=I%
P%+=KLM%
!(keybase%+P%)=0
!(keybase%+P%+4)=0
$(keybase%+P%+8)=S$
!(keybase%+P%+KL%(key%)+9)=0
"Hourglass_Off"
save_recs(f$,RA%)
dbasehandle%,I%,J%,zero%,rec$
I%=1
fields%
len%(I%)=0
zero%+=1
rec$=
fields%-zero%-1,
(10))
"Hourglass_On"
dbasehandle%=
I%=0
#dbasehandle%=I%*Length%
#dbasehandle%,rec$
"Hourglass_Percentage",(I%*100)
#dbasehandle%=(RA%+1)*Length%
close_file(dbasehandle%)
"OS_File",18,f$,&fff
"Hourglass_Off"
move_records(key%,source%,dest%,top)
P%,R%,target$,action$,blobs$,ex%,ptr%,file%,deleted%
"target$=$Query%:Search$=
parse
Title$,"."):Title$=" "+
Title$,P%+2)
I%=1
(Title$)
Title$,I%,1)=","
Title$,I%,1)=" "
target$=""
MarkedRecs%>0
bit$=Title$+" ,"
bit$=" all ,"
tail$=""
bit$=" ,":tail$="when "+Title$
"Wimp_WhichIcon",moveW%,block%,&003F0000,&00210000
movetype%=!block%
movetype%
4:action$=
msg("Err138,"+bit$+
(source%)+","+
(dest%)+","+tail$):
Move
5:action$=
msg("Err140,"+bit$+
(source%)+","+tail$):
selected(prefsW%,15)
action$+=". "+
msg("Err141"):
Delete
6:action$=
msg("Err139,"+bit$+
(source%)+","+tail$):dest%=source%:
Collect
file%=0
movetype%
7
4,5:
file%=source%
filemem%(file%,key%)=-1
4
dest%<>file%
filemem%(file%,key%)=-1
file%
confirm(action$)
I%=1
fields%
V%=chartype%(I%)
36,37,38,39,40:
blobs$+=
(I%)+","
blobs$<>""
deleted%=
($database%+".Deleted")
"Hourglass_On"
*dbasehandle%=
($database%+".Database")
8SHmisc%=
extend_named_sliding_block(tempanchor%,RA%)
earmark(SHmisc%,
,file%,top)
close_file(dbasehandle%)
R%=0
RA%-1
6 ex%+=1:
"Hourglass_Percentage",(ex%*100)
ptr%=SHmisc%
file%=ptr%?R%
file%<>255
movetype%
N
4,5:
file%=source%
transfer_record(R%,blobs$):
MOVE or DELETE
G
dest%<>file%
transfer_record(R%,blobs$):
ACCUMULATE
close_file(deleted%)
"Hourglass_Off"
asterisk(
transfer_record(REC%,blobs$)
key%,F%,P%,V%
read(
,fields%,
,REC%,$database%)
top=8*file%+LH%
N$=key$(key%)
delete(N$,key%):date%?file%=1:$Date%(file%)=
today
N$<>"*Failed*"
movetype%
DELETE
0
selected(prefsW%,15)
blank(REC%)
blobs$<>""
F%=
(blobs$)
P%=
blobs$,",")
blobs$=
blobs$,P%+1)
V%=chartype%(F%)
9
blob_path(
,$database%,REC%,F%,V%,F$)>=0
'
selected(prefsW%,15)
(
"OS_CLI","Delete "+F$
,
"OS_CLI","Remove "+F$+"D"
E
"OS_CLI","Rename "+F$+" "+F$+"D":
#deleted%,F$+"D"
MOVE
top=8*dest%+LH%
F
insert(N$,key%,dupwarn%):date%?dest%=1:$Date%(dest%)=
today
key%+=1
key%>Keys%
N$="*Failed*"
export_subset(f$)
I%,F,R%,R4%,recs%,ptr%,count%,subtotal%,blobs%,ex%,Z%,len%,source$,dest$,O$,REC%,zero%,remove%,S$
R4%<>-1
"OS_GBPB",9,$database%,block%,1,R4%,255
,,S$,,R4%
?
"indexes","Menus","PrintRes","ValTables","UserFuncs":
D
"OS_CLI","Copy "+$database%+"."+S$+" "+f$+"."+S$+" ~C~VR"
}
"Form","FieldCols","!Run","Link","Data","Calc","Config","UsrSprites","CSVoptions","Preference","Subfiles","Winpos":
C
"OS_CLI","Copy "+$database%+"."+S$+" "+f$+"."+S$+" ~C~V"
"Hourglass_On"
8SHmisc%=
extend_named_sliding_block(tempanchor%,RA%)
Search$=
parse
*dbasehandle%=
($database%+".Database")
earmark(SHmisc%,
,file%,top)
(f$+".Database")
ptr%=SHmisc%
%subtotal%=
count_recs(key%,zero%)
"blobs%=
find_blobs($database%)
I%=0
RA%-1
ptr%?I%<>255
ptr%?count%=ptr%?I%
ex%=-1
ex%<blobs%
ex%+=1:F%=Ext%(ex%)
=
copy_blob($database%,f$,I%,recs%,F%,chartype%(F%))
<
readsmarray(dbasehandle%,I%):
writesmarray(F,recs%)
count%+=1
:
"Hourglass_Percentage",(count%*100)
subtotal%
ex%=0
blobs%
F%=Ext%(ex%)
'##
vtype$(chartype%(F%))="L"
'$# S$=Tag$(F%)+"scroll.Format"
'%D
"XOS_CLI","Copy "+$database%+"."+S$+" "+f$+"."+S$+" ~C~V"
'&" S$=Tag$(F%)+"scroll.Blank"
''D
"XOS_CLI","Copy "+$database%+"."+S$+" "+f$+"."+S$+" ~C~V"
'( S$=Tag$(F%)+"scroll.Max"
')D
"XOS_CLI","Copy "+$database%+"."+S$+" "+f$+"."+S$+" ~C~V"
recs%>0
'-? F$()="":
writesmarray(F,recs%):
#F=Length%*recs%:recs%-=1
K%=0
Keys%
KL%(MaxKeys%+1)=KL%(K%)
I%=0
'1' KF%(MaxKeys%+1,I%)=KF%(K%,I%)
'2' KW%(MaxKeys%+1,I%)=KW%(K%,I%)
'4-
make_empty_index(recs%,MaxKeys%+1,
REC%=0
recs%-1
readsmarray(F,REC%)
KEY$=
key2(K%,1)
file%=ptr%?REC%
top=8*file%+LH%
':$
insert(KEY$,MaxKeys%+1,
';6
"Hourglass_Percentage",(REC%*100)
recs%
REC%
'=& keybase%=SHkeyptr%(MaxKeys%+1)
'>? filelength%=
sliding_block_size(keyanchor%(MaxKeys%+1))
'?.
K%>0
index$="indexes."
index$=""
'@T
"OS_File",10,f$+"."+index$+Index$(K%),&7f0,,keybase%,keybase%+filelength%
'A,
scrap_block(keyanchor%(MaxKeys%+1))
'C+
softerror(
leaf(f$),171):remove%=
close_file(F)
close_file(dbasehandle%)
"OS_File",18,f$+".Database",&fff
export%=
"Hourglass_Off"
close_it(savesubW%)
remove%
'L*
"OS_CLI","Remove "+f$+".Database"
'MD
write_log(-1,"Subset exported:",
leaf(f$)+" ("+$Query%+")")
copy_files(source$,dest$)
N%,R4%,S$,S%
"OS_CLI","Remove "+dest$+".PrimaryKey"
"OS_CLI","Remove "+dest$+".Database"
These may not be present but remove if they are
'V N%=-1
R4%<>-1
'X9
"OS_GBPB",9,source$,block%,1,R4%,255
,,S$,,R4%
'Z?
"indexes","Menus","PrintJobs","PrintRes","ValTables":
'[D
"OS_CLI","Copy "+source$+"."+S$+" "+dest$+"."+S$+" ~C~VR"
'\q
"PrimaryKey","Config","UserFuncs","UsrSprites","CSVoptions","Preference","FieldCols","Data","Subfiles":
']G
"OS_CLI","Copy "+source$+"."+S$+" "+dest$+"."+S$+" ~C~V"
'` R4%=0
R4%<>-1
'b9
"OS_GBPB",9,source$,block%,1,R4%,255
,,S$,,R4%
S$,4)
'd&
"text","draw","rite","roll":
'eD
"OS_CLI","Copy "+source$+"."+S$+" "+dest$+"."+S$+" ~C~VR"
find_blobs(f$)
N%,R4%,S$
N%=-1:Ext%()=0
R4%<>-1
'n4
"OS_GBPB",9,f$,block%,1,R4%,255
,,S$,,R4%
S$,4)
'p)
"text","draw":tag$=
(S$)-4)
'q( N%+=1:Ext%(N%)=
field(X%,tag$,
'r)
"rite","roll":tag$=
(S$)-6)
's( N%+=1:Ext%(N%)=
field(X%,tag$,
earmark(ptr%,all%,file%,top)
I%,P%
I%=0
RA%-1
ptr%?I%=255
"Hourglass_On"
file%=0
all%
top=8*file%+LH%
! P%=
neighbour(key%,top,1)
,
scan_file("P%<>top",key%,file%,2,1)
&
selected(queryW%,file%+6)
top=8*file%+LH%
# P%=
neighbour(key%,top,1)
.
scan_file("P%<>top",key%,file%,2,1)
file%
"Hourglass_Off"
rotate
Access%
confirm(
msg("Err49"))=
keybase%
I%,L%,Z%,Q%,R%,S%,key%
key%=0
Keys%
keybase%=SHkeyptr%(key%)
S%=LH%+40
Z%=keybase%!S%
I%=S%-8
S%-40
) L%=keybase%!I%:R%=keybase%!(I%+4)
=
L%>0
keybase%!(I%+8)=L%
keybase%!(I%+8)=-(I%+8)
Z%>0
keybase%!(S%-40)=Z%
keybase%!(S%-40)=-(S%-40)
I%=S%-40
Q%=I%-8
Q%=S%-48
Q%=S%
! PR%=
neighbour(key%,I%,0)
! SU%=
neighbour(key%,I%,1)
'
PR%>S%
keybase%!(PR%+4)=-I%
#
SU%>S%
keybase%!SU%=-I%
key%
$date%=
asterisk(
write_log(-1,"Subfiles rotated","")
create_index(key%,warn%)
indexing%
printing%
file%,top,P%,KEY$,REC%,val$,zero%,replace%,J%,I%,used$,abort%,Z%
newkey%=0:f$=""
J%=0
keyfield%(J%)>0
# f$+=Tag$(keyfield%(J%))+"+"
Z%=
I%=0
*
keyfield%(J%)=KF%(0,I%)
-
used$+=Tag$(keyfield%(J%))+";"
used$=
used$)
used$<>""
warn%=
confirm(
msg("Err100,"+used$))=
f$)="+"
u(f$)
newkey%+=1
u(Index$(newkey%))=f$
newkey%>Keys%
newkey%=key%:
softerror(f$,106):abort%=
newkey%<=Keys%:
replace%=
warn%
confirm(
msg("Err50,"+f$))=
abort%=
Keys%=MaxKeys%:
softerror("subsidiary indexes,"+
(Keys%)+",Keys",23):abort%=
:Keys%=newkey%
abort%
copy_keydata(newkey%)
Index$(newkey%)=f$
-f$=$database%+".Indexes."+Index$(newkey%)
make_empty_index(RA%,newkey%,
lit(iconbarM%,2,
limit_actions(
,multitask%)
abort_index(f$):
*dbasehandle%=
($database%+".Database")
indexing%=
:Search$="TRUE"
update_stats
"Hourglass_On"
file%=0
top=file%*8+LH%
P%=
neighbour(key%,top,1)
val$=
type(newkey%)
"Hourglass_On"
scan_file("P%<>top",key%,file%,4,1)
file%
"Hourglass_Off"
end_index
refresh_pointers
save_keys
colour(newkey%,2)
asterisk(
make_index_menu
renew_tables
write_log(-1,"Index "+Index$(newkey%)+" created","")
refresh_pointers
I%=0
Keys%
# SHkeyptr%(I%)=!keyanchor%(I%)
remove_index(name$,rename%)
I%,f$,entry$
Fkey%=0:
colour(key%,1):
set_keydata(key%):addr=
moveto(key%,top,1)
text(searchW%,3)=Index$(key%):
redraw_icon(searchW%,3)
f$=$database%+".Indexes."
I%=1
Keys%
entry$=Index$(I%)
entry$=name$
Index$(I%)=""
rename%
.
"OS_File",5,f$+"Del_"+entry$
=
d%=1
"OS_CLI","Remove "+f$+"Del_"+entry$
=
"OS_CLI","Rename "+f$+name$+" "+f$+"Del_"+entry$
*
"OS_CLI","Remove "+f$+name$
colour(I%,3)
make_index_menu
renew_tables
make_index_menu
ptr%,menu$,I%
"menu_ptr%=
clear_dynamic_menus
ptr%=menu_ptr%
Keys%>0
menu$="indexes,"
I%=1
Keys%
E
hide%?KF%(I%,0)<>1
Index$(I%)<>""
menu$+=Index$(I%)+","
menu$=
menu$)
menu$<>"indexes"
, indexesM%=
create_menu(ptr%,menu$)
: ptr%=indexM%+52:ptr%!4=indexesM%:
lit(indexM%,1,
5
ptr%=indexM%+52:ptr%!4=-1:
lit(indexM%,1,
abort_index(f$)
end_index
replace%
load_index(f$,newkey%,
index%=newkey%
Keys%
) Index$(newkey%)=Index$(newkey%+1)
index%
( '
scrap_block(keyanchor%(newkey%))
Keys%-=1
newkey%=0
softerror("",43)
wimp_error(
end_index
"Hourglass_Smash"
indexing%=
limit_actions(Access%,multitask%)
"Wimp_CreateMenu",,-1
lit(iconbarM%,2,Modify%)
close_file(dbasehandle%)
shift(t%,k%,m%)
a%,key%,fi%,I%,F$,action$,finished%,fail%
Access%
=addr
key$(0)=""
=addr
REC%=RA%
=addr
t%=0
m%=1
confirm(
msg("Err51"))=
=addr
N$=key$(key%)
delete(N$,key%)
(<:
key%=k%
next_match(addr,1,Filter$,finished%)
(=
t%=1
fi%=(file%+1)
(>)
t%=-1
fi%=(file%-1-6*(file%=0))
top=8*fi%+LH%
I%=1
fields%
V%=chartype%(I%)
(E)
36,37,38,39,40,64,65,66,67:
(FR
blob_path(
,$database%,REC%,I%,V%,F$)>=0
"OS_CLI","Delete "+F$
(J@
insert(N$,key%,dupwarn%):date%?fi%=1:$Date%(fi%)=
today
top=8*file%+LH%
date%?file%=1
$Date%(file%)=
today
key%+=1
key%>Keys%
N$="*Failed*"
N$="*Failed*"
=addr
selected(prefsW%,15)
blank(REC%)
(V& action$=" Deleted and blanked"
action$=" Deleted"
(Y'
:action$=" ===> subfile "+
(fi%)
asterisk(
write_log(REC%,logentry$+action$,"")
blank(REC%)
dbasehandle%
(a*dbasehandle%=
($database%+".Database")
(b,F$()="":
writesmarray(dbasehandle%,REC%)
close_file(dbasehandle%)
type(key%)
F%,V$
key%>=0
F%=KF%(key%,0)
F%=-key%
chartype%(F%)
(j2
3,6,46,47,54,56,57,74,75,77,78,79:V$="VAL"
getscreensize(
S_Width%,
S_Height%,
Vpix%)
H1%,V1%,H2%,V2%,End%
(p$H1%=0:V1%=4:H2%=8:V2%=12:End%=16
(q9Mi%!H1%=4:Mi%!V1%=5:Mi%!H2%=11:Mi%!V2%=12:Mi%!End%=-1
"OS_ReadVduVariables",Mi%,Mo%
(s)S_Width%=(1<<(Mo%!H1%))*((Mo%!H2%)+1)
(t*S_Height%=(1<<(Mo%!V1%))*((Mo%!V2%)+1)
Vpix%=Mo%!V2%+1
match(X%,Y%)
check_record
deselect(matchW%,
selected_esg(matchW%,1))
select(matchW%,8):$
text(matchW%,0)="Print"
text(queryW%,5)="":
redraw_icon(queryW%,5)
shade(matchW%,4,
shade(matchW%,6,
shade(matchW%,12,
shade(matchW%,7,printorder$<>"")
lit(printM%,9,printorder$<>"")
QBE%
set_dest_sprite
position_window(matchW%,X%,Y%,0,0,0,0)
set_caret(0,queryW%,0)
Match_tag%>0
text(helpW%,0)=Tag$(Match_tag%)
text(helpW%,0)=""
$ fieldsM%=
field_menu(items%,1)
tick_one(fieldsM%,0,fields%-1,Match_tag%-1)
redraw_icon(helpW%,0)
Ecalc%
!
text(matchW%,13)=""
'
text(matchW%,13)="1 calc"
/
text(matchW%,13)=
(Ecalc%)+" calcs"
redraw_icon(matchW%,13)
select(matchW%,2):
mouse(0,0,4,matchW%,2)
matching%=
List printing -----------------------------------------------------
do_it(Search$,displayed%)
printing%
zero%,P%,rec%,copy%,sel$,default%,matchopt%,stime%,sorton%,concatenations%
Sum(),S$(),f%()
Sum(numericfields%,5),S$(5),f%(5)
2S$()="Items","Sum","Mean","StdDev","Max","Min"
wimp_error(
&matchopt%=
selected_esg(matchW%,1)
printed%=0
matchopt%=8
print_init("")
printorder$=""
. sel$=$database%+".PrintRes.!Selection"
&
"OS_File",5,sel$
default%
default%=0
W%=0
F%=KF%(0,W%)
F%>0
T F$=
~(F%):
(F$)=1
F$="0"+F$:
printorder$,F$)=0
printorder$+=F$
p
select(mainW%,field%(F%)):
lit(printM%,7,
lit(printM%,8,
lit(mainM%,7,
selected(passW%,13))
default%=1
!
load_selection(sel$)
Form$=printorder$
PrintFields%=
(Form$)
format$="label"
( lablines%=labdepth%
linedepth%
$
fixed1$<>""
lablines%-=1
$
fixed2$<>""
lablines%-=1
>
selected(printerW%,41)
lablines%-=1:
Include key
I%=1
(Form$)-1
F$=
Form$,I%,2)
F%=
("&"+F$)
-
(F%
128)>0
concatenations%+=1
!
abort_report:
]
(PrintFields%-concatenations%)>lablines%
moan_err%,
msg("Err181,"+
(lablines%))
% Heading$="":Hlongest%=0:Sum()=0
numericfields%>0
I%=1
numericfields%
Sum(I%,5)=10^30
include_fields:
LenLine% is defined in this procedure
TextPtr%=!textanchor%
list_head
Error lines moved from here
abort_report:
"Wimp_GetPointerInfo",,block%
limit_actions(
,multitask%)
lit(iconbarM%,2,0)
printing%=
"OS_ReadMonotonicTime"
stime%
ON ERROR statement was originally here
*dbasehandle%=
($database%+".Database")
!direc%=
selected(queryW%,4)+1
"Hourglass_On"
displayed%>=0:
readsmarray(dbasehandle%,displayed%)
print_record(displayed%,addr)
printed%=1
usekey%=-1:
text(queryW%,5)="":
redraw_icon(queryW%,5)
scan_marked_subfiles("P%<>top",key%,1,direc%,
text(queryW%,5)=
(usekey%):
redraw_icon(queryW%,5)
complete(1)
scan_marked_subfiles("P%<>top AND LEFT$(k$,kl%)=useval$",usekey%,1,1,
end_printing
abort_report
reportdest$="Printer"
printhandle%>0
*
"PDriver_AbortJob",printhandle%
!
close_file(printhandle%)
close_it(informW%)
"Hourglass_Smash"
reportdest$=""
lose_fonts
printing%
end_printing
close_file(dbasehandle%)
softerror("",29)
wimp_error(
end_printing
time%,batch%,rem%
matchopt%
text(matchW%,13)=
(printed%)+" found":
Count
Print
printed%=0
empty_list
format$
"horiz":
2
displayed%=-1
total_list:
page_number
SHrecptr%=!recanchor%
0
shrink%
remove_white_space(format$)
add_spacers(Count%)
"table":
) #
blank_lines(tabextrarows%)
total_list:
page_number
"vert":
2
displayed%=-1
total_list:
page_number
4
shrink%
remove_white_space(format$)
"OS_ReadMonotonicTime"
etime%
time%=etime%-stime%
text(matchW%,13)=
(time%
100)+"."+
(time%
100)+" sec"
reportdest$
"Window":
.
selected(printW%,47)
z%=1
z%=-1
,
sorton%>0
sort_list(sorton%,z%)
screen_list
"File":
.
selected(printW%,47)
z%=1
z%=-1
0
sorton%>0
sort_list(sorton%,z%)
=
"OS_GBPB",2,texthandle%,SHtextptr%,Count%*LenLine%
close_file(texthandle%)
lose_list
close_window(saveW%)
savetofile%=
"Printer":
) "
Count%>0
labcount%>0
sorton%>0
)"2
selected(printW%,47)
z%=1
z%=-1
)#"
sort_list(sorton%,z%)
I%=0:rem%=Count%
)%, batch%=pagelength%*printcolumns%
rem%>batch%
)'+
direct_print(I%,I%+batch%-1)
)(% I%+=batch%:rem%-=batch%
)*'
direct_print(I%,I%+rem%-1)
)+'
direct_print(0,Count%-1)
)-
).(
"PDriver_EndJob",printhandle%
)/!
close_file(printhandle%)
)0.
SYS "PDriver_SelectJob",previousjob%
lose_fonts
Output%=2
inform("",194,0)
)4M
"OS_CLI","Copy <Wimp$ScrapDir>.Printers.PBreport printer: ~CF~V"
)5@
"OS_CLI","Remove <Wimp$ScrapDir>.Printers.PBreport"
close_it(informW%)
)7
)9(
limit_actions(Access%,multitask%)
):2 $
text(queryW%,5)="":
redraw_icon(queryW%,5)
);%
default%=1
clear_selection
9,10:
Mark, Clear
)=- $
text(matchW%,13)=
(printed%)+" found"
)>-
set_icon(markW%,0,(SHmarkptr%?REC%=1))
close_file(dbasehandle%)
redraw_icon(matchW%,13)
lit(iconbarM%,2,Modify%)
warn_of_marks
"Hourglass_Off"
printing%=
write_log(-1,"Report printed: "+query$,"")
remove_white_space(format$)
I%,L%,N%,R%,Ls%,line%,LenLine2%,blank$
Tab2%()=Tab%()
format$
"horiz","table":
)N" diff%()=maxlen%()-truelen%()
Ls%=
(spacer$)
N%=1
last%=
(Form$)-1
I%=1
last%
N%+=1
F%=
fnum(
Form$,I%,2))
L%+=diff%(F%)
)V. Tab2%(N%)=truelen%(F%)+Tab2%(N%-1)+Ls%
LenLine2%=LenLine%-L%
"vert":
)Z?
Tab2%(2)+TextLine%>Tab%(3)
Tab%(3)=Tab2%(2)+TextLine%
LenLine2%=Tab%(3)+2
LenLine2%<maxhead%+3
LenLine2%=maxhead%+3
)_' blank$=
maxhead%-Tab2%(N%)+2," ")
TextPtr%=SHtextptr%
TextPtr2%=TextPtr%
line%=0
Count%-1
format$
"horiz","table":
R%=SHrecptr%!(line%*4)
R%=-2
)hP
"Wimp_TransferBlock",mytask%,TextPtr%,mytask%,TextPtr2%,LenLine2%-1
shrink
)j
"vert":
)lN
"Wimp_TransferBlock",mytask%,TextPtr%,mytask%,TextPtr2%,LenLine2%-1
)n TextPtr2%?(LenLine2%-2)=32
)o TextPtr2%?(LenLine2%-1)=10
TextPtr2%+=LenLine2%
TextPtr%+=LenLine%
line%
Tab%()=Tab2%()
LenLine%=LenLine2%
TextPtr%=!textanchor%
)vGSHtextptr%=
extend_named_sliding_block(textanchor%,Count%*LenLine%)
SHrecptr%=!recanchor%
shrink%=
shrink
I%=0
N%-1
from%=TextPtr%+Tab%(I%)
to%=TextPtr2%+Tab2%(I%)
bytes%=Tab%(I%+1)-Tab%(I%)
"Wimp_TransferBlock",mytask%,from%,mytask%,to%,bytes%
#$(TextPtr2%+Tab2%(N%)-1)=blank$
add_spacers(N%)
B%,I%,L%,P%,T%,fields%,sp$
vrules%
(spacer$)
spacer$=
L%," ")
TextPtr%=SHtextptr%
fields%=
(Form$)
spacer$)):
PROCstore_string will overwrite character after
spacer with a space. Use shortened spacer (sp$) & poke final character
in afterwards.
*T%=Tab%(1):Tab%()=Tab%()-L%:Tab%(1)=T%
spacer$)
L%-=1
selected(printW%,29)
N%-=2
N%-=1
I%=1
SHrecptr%!(I%*4)
A
-2,-3:
No spacer added for header,footer & ruler lines
J%=2
fields%
# P%=(I%*LenLine%)+Tab%(J%)
!
store_string(sp$,P%,
TextPtr%?(P%+L%)=B%
print_record(REC%,address%)
I%,F%,S%,N%,V%,Z%,F$,SF$,Tab%,n$,y$,pos%,length%,recdepth%,countpos%,last%,lf%,flag%,scrcol%,sp$,colprt%
format$="label"
labcount%+=1:labfield%=1
selected(printerW%,41)
Label$(labcount%,0)=
key2(0,1)
"scroller_ptr%()=0:pending%()=
%countpos%=Count%:last%=
(Form$)-1
pos%=Tab%(1)
I%=1
last%
I%<last%
sp$=spacer$
sp$=""
F%=
fnum(
Form$,I%,2))
N%+=1
>
0:F$=
(REC%):
format$<>"vert"
(F$)," ")+F$
J
MaxFields%+1:Z%=
rec_no(F$,key%,address%):F$=
stripright(F$,"#")
D
MaxFields%+2:F$=
(file%):
format$<>"vert"
6," ")+F$
selected(printW%,5)
7 F$=
expand(F$(F%),link$(F%),Len%,SF$,scrcol%)
%
F$=F$(F%):Len%=len%(F%)+2
V%=chartype%(F%)
!
V%<>36
V%<>39
lf%=
254,255:
`
calc_error(F$,F%,ephemera$(C%,0),ephemera$(C%,1)):
moan_err%,
msg("Err29")
C%=F%-MaxFields%-3
F$=
(ephemera$(C%,1))
&
V%=254
format$<>"vert"
' F$=
justify(F$,N%+1,N%,sp$)
)
PROCsums(F$,calcrow%?F%,V%)
41,42,43,61,62:
Z%=
no_yes(F%,F$)
0
3,6,8,46,47,54,56,57,74,75,77,78,79:
format$<>"vert"
' F$=
justify(F$,N%+1,N%,sp$)
$
sums(F$,calcrow%?F%,V%)
9
format$<>"vert"
justify(F$,N%+1,N%,sp$)
64,65,66,67:
! S%=
scroller_number(F%)
pending%(S%)=
:flag%=
Z
ScrollForm$="C"
colprt%=
read_scroller_row(REC%,F%,S%,V%-63,
,cellsep$)
selected(printW%,6)
u(F$)
format$
"horiz","table":
64,65,66,67:
ScrollForm$="R"
/
print_scroller_as_row(Tab%(N%),N%)
(
store_string(F$,Tab%(N%),
5
(F$)>truelen%(F%)
truelen%(F%)=
adjust_width
&
store_string(F$,Tab%(N%),
3
(F$)>truelen%(F%)
truelen%(F%)=
adjust_width
"vert":
&
lf%
end_line:pos%=Tab%(1)
%
selected_esg(printW%,1)
-
1:Head$=Tag$(F%):tail$=":"+
(160)
?
2:Head$=$
text(mainW%,(desc%(F%))):tail$=":"+
(160)
$
36:Head$="":tail$=
(160)
pos%=Tab%(1)
/ Head$=
justify(Head$,2,1,tail$)+tail$
%
Head$=spacer$+Head$+tail$
2
store_string(Head$,pos%,
):pos%+=
(Head$)
&
36,39:
print_memo(REC%,F%)
64,65,66,67:
store_rec_num(REC%)
ScrollForm$="R"
*
print_scroller_as_row(pos%,2)
.
flag%
store_string(F$,pos%,
5
(F$)+pos%>Tab%(3)
Tab%(3)=
(F$)+pos%
K
pending%(S%)
finish_scroller_printing(REC%,F%,S%,V%-63,pos%)
store_rec_num(REC%)
.
store_string(F$,pos%,
):pos%+=
#
reportdest$="Printer"
. w1%=
how_wide(F$,0,0,bodyfont%,-1)
(
concat%
w%+=w1%
w%=w1%
0
w%>maxlenP%(2)
maxlenP%(2)=w%+32
%
concat%
I%+1=
(Form$)
'
pos%>Tab%(3)
Tab%(3)=pos%
end_line
pos%=Tab%(1)
lf%=
H
reportdest$="Printer"
store_string(
(160),pos%,
):pos%+=1
*
"label":
& S$=Label$(labcount%,labfield%)
(
S$=""
S$=F$
S$+=spacer$+F$
F%=labsubfor%
$
S$=""
S$=F$(labsubst%)
& Label$(labcount%,labfield%)=S$
"
concat%
labfield%+=1
format$
"horiz","table":
store_rec_num(REC%)
end_line
colprt%
D
(pending%())<>0
print_rest_of_scrollers(REC%)
"vert":
"label":
labcount%=labpage%
direct_print(0,Count%-1)
recdepth%=Count%-countpos%
format$<>"label"
displayed%=-1
* ,
Printable%<(recdepth%-2*(page%>0))
*!!
reportdest$="Printer"
pagecolumn%+=1
sorton%=0
*$P
pagecolumn%=printcolumns%
page_number:
direct_print(0,Count%-1)
*%F
pagecolumn%=printcolumns%
page_number:pagecolumn%=0
page_number
*(
Printable%=pagelength%
**?
selected(printW%,4)
list_head
header_lines%=0
adjust_width
reportdest$="Printer"
*1' w%=
how_wide(F$,0,0,bodyfont%,-1)
w%+=spacerlen%
*3)
w%>maxlenP%(N%)
maxlenP%(N%)=w%
print_scroller_as_row(pos%,N%)
L%,P%
P%=TextPtr%+pos%
pending%(S%)
*;F F$=
read_scroller_row(REC%,F%,S%,V%-63,shrinkscroller%,cellsep$)
*<-
pending%(S%)
F$<>""
F$+=rowterm$
store_string(F$,pos%,
L%+=
pos%+=
L%>truelen%(F%)
truelen%(F%)=L%
format$="vert"
pos%>Tab%(3)
Tab%(3)=pos%
reportdest$="Printer"
*D) w%=
how_wide("",P%,L%,bodyfont%,-1)
w%+=spacerlen%
*F)
w%>maxlenP%(N%)
maxlenP%(N%)=w%
page_number
line$
pagenumber%+=1
page%>0
Include page numbers
blank_lines(1)
store_rec_num(-2)
*Q6
store_string("Page "+
(pagenumber%),Lmargin%,
print_memo(R%,F%)
F,B%,F$,sp%,L%,LF%,rem$,pos%,Line$,brk%,w%,wh%
"OS_Byte",229,1:
"OS_Byte",124
pos%=Tab%(2)
reportdest$="Printer"
wh%=
how_wide(Head$,0,0,headerfont%,-1)
blob_path(
,$database%,R%,F%,36,F$)>=0
*]% Line$=rem$:L%=
(Line$):brk%=
*^
B%=
Line$+=
(B%):L%+=1
*a#
reportdest$="Printer"
*b0 w%=
how_wide(Line$,0,0,bodyfont%,-1)
*c*
wh%+w%>columnwidth%
brk%=
B%=32
sp%=L%
*f+
B%=10
L%>TextLine%
brk%
*h-
B%=10:rem$="":Line$=
Line$):LF%=
#F:rem$="":LF%=
*j8
:rem$=
Line$,sp%+1):Line$=
Line$,sp%-1):LF%=
*k
store_rec_num(REC%)
*m%
store_string(Line$,pos%,LF%)
close_file(F)
"OS_Byte",229,0
inmemo(F%,s$)
len%,found%,line$,ptr%,case%
*v*len%=
load_blob($database%,REC%,F%,36)
len%>0
*x case%=
selected(queryW%,1)
ptr%=-1
line$=""
*|
*}( ptr%+=1:line$+=
(SHmisc%?ptr%)
*~"
(line$)>250
ptr%=len%
#
case%
line$=
u(line$)
*
s$<>""
line$,s$)>0
found%=
ptr%=len%
s$=""
found%=
=found%
wc(f$,t$)
failed%,P%,Q%,F%,end%,c$,x$,s$
P%+=1
c$=
t$,P%,1)
(
"":end%=(Q%=F%):failed%=
end%
$wc%:
P%+=1:Q%+=1
c$=
t$,P%,1)
c$<>$wc%
P%-=1
$ws%:
R%=P%+1
P%+=1
c$=
t$,P%,1)
#
c$=$ws%
c$=$wc%
c$=""
"":end%=
- s$=
t$,R%):failed%=(
(s$))<>s$)
$wc%,$ws%:
7 s$=
t$,R%,P%-R%):Q%=
f$,s$,Q%):failed%=(Q%=0)
9 Q%+=
(s$)-1:P%-=1:
failed%
failed%=(Q%=F%)
Q%+=1:x$=
f$,Q%,1)
failed%=(c$<>x$)
end%
failed%
failed%
print_labels(x0%,y0%)
row%,column%,label%,line%,S$
label%=1
labpage%
Label$(label%,1)<>""
# column%=(label%-1)
labup%
row%=(label%-1)
labup%
x%=x0%+column%*labwidth%
y%=y0%-row%*labdepth%
.
print_label_line(fixed1$,headerfont%)
line%=1
lablines%
;
print_label_line(Label$(label%,line%),bodyfont%)
line%
.
print_label_line(fixed2$,headerfont%)
4
print_label_line(Label$(label%,0),keyfont%)
label%
print_label_line(S$,font%)
S$<>""
"ColourTrans_SetFontColours",font%,&ffffff00,0,14
"Font_Paint",font%,S$,16,x%,y%
y%-=linedepth%
read_print_options(dest$,wi%,wi2%)
S$,extra%,header%,footer%,status%,flags%,ps%
dest$=""
selected_esg(wi%,4)
!
22:reportdest$="Window"
23:reportdest$="File"
"
25:reportdest$="Printer"
0
printer_driver(Z$)
moan_err%,Z$
.
"XParallel_Op",0
,,status%;flags%
(flags%
1)=0
B
If error flag set hardware is too old to report status
E
DON'T report printer as 'not ready' - have to trust user!
J
IF ((status%>>3) AND 1)=0 THEN ERROR moan_err%,FNmsg("Err182")
reportdest$="Window"
selected_esg(wi%,3)
15:format$="horiz"
16:format$="vert"
selected_esg(wi%,6)
40:ScrollForm$="R":shrinkscroller%=
selected(wi%,43)
41:ScrollForm$="C"
,cellsep$=
convert_spacer($
text(wi%,50))
,rowterm$=
convert_spacer($
text(wi%,51))
usekey%=-1
S$=Index$(key%)
S$=Index$(usekey%)+" index"
Title1$="Ordered by "+S$
Title2$=$
text(wi%,10)
+spacer$=
convert_spacer($
text(wi%,26))
vplot%=0
spacer$,"|")>0
vplot%=5
spacer$,"
")>0
vplot%=21
vplot%>0
reportdest$
"Window":vrules%=
"File":vrules%=
>
"Printer":
(spacer$)<3
spacer$=
3," "):vrules%=
vrules%=
)Lmargin%=1:Tab%(0)=0:Tab%(1)=Lmargin%
Tmargin%=1
TextLine%=
text(wi%,18))
pagelength%=
text(wi%,9))
pagelength%=0
pagelength%=1000000
selected(wi%,28)
header%=6
header%=0
selected(wi%,29)
footer%=3
footer%=0
selected(wi%,35)
page%=1
page%=0
pagenumber%=0
+extra%=2*page%+Tmargin%+header%+footer%
shrink%=
selected(wi%,24)
&colour%=
get_icon_cols(printW%,53)
Cheaderwimpcol%=colour%
16:headercol%=wimpcol%(headerwimpcol%)
&colour%=
get_icon_cols(printW%,54)
=bodywimpcol%=colour%
16:bodycol%=wimpcol%(bodywimpcol%)
&colour%=
get_icon_cols(printW%,55)
=rulewimpcol%=colour%
16:rulecol%=wimpcol%(rulewimpcol%)
reportdest$="Printer"
pause%=
selected(wi2%,87)
shrink%=
Lmargin%=0
Tmargin%=0
tabextrarows%=0
selected_esg(wi2%,7)
61:pointsize%=8
62:pointsize%=10
63:pointsize%=12
64:pointsize%=14
'
:pointsize%=
text(wi2%,65))
&
pointsize%=0
pointsize%=10
get_fonts
+ 6 spacerlen%=
how_wide(spacer$,0,0,headerfont%,-1)
spacerlen%<6
spacerlen%=6
selected_esg(wi2%,1)
orientation$="upright"
$ Plmargin%=
convert_to_OS(14)
$ Prmargin%=
convert_to_OS(15)
$ Ptmargin%=
convert_to_OS(16)
$ Pbmargin%=
convert_to_OS(18)
orientation$="sideways"
$ Plmargin%=
convert_to_OS(16)
$ Prmargin%=
convert_to_OS(18)
$ Ptmargin%=
convert_to_OS(15)
( Pbmargin%=
convert_to_OS(14)
selected_esg(wi2%,9)
80:printcolumns%=1
81:printcolumns%=2
85:printcolumns%=3
86:printcolumns%=4
printcolumns%=1
gutter%=0
gutter%=
convert_to_OS(82)
"PDriver_Info"
,,,n%
+!= ps%=((n%
(1<<29)<>0)):
Is this a PostScript printer?
Output%
+#&
1:printhandle%=
("printer:")
+$?
2:printhandle%=
("<Wimp$ScrapDir>.Printers.PBreport")
inform("",193,0)
"OS_Byte",229,0
+(:
"PDriver_SelectJob",printhandle%,0
previousjob%
ps%
declare_fonts
+*C
get_document_size(left%,bottom%,right%,top%,paperx%,papery%)
selected(wi2%,68)
+,+
Plmargin%>left%
left%=Plmargin%
+-/
Pbmargin%>bottom%
bottom%=Pbmargin%
+.=
Prmargin%>paperx%-right%
right%=paperx%-Prmargin%
+/9
Ptmargin%>papery%-top%
top%=papery%-Ptmargin%
+1! leading%=
text(wi2%,56))
+2#
leading%<100
leading%=100
+3+ linedepth%=(pointsize%*leading%)
orientation$
+5=
"upright":pagelength%=(top%-bottom%-8)
linedepth%
+6O columnwidth%=(right%-left%-(gutter%*(printcolumns%-1)))
printcolumns%
+7>
"sideways":pagelength%=(right%-left%-8)
linedepth%
+8O columnwidth%=(top%-bottom%-(gutter%*(printcolumns%-1)))
printcolumns%
columnwidth%-=12
+; copies%=
text(wi2%,45))
+<
selected_esg(wi2%,2)
7:format$="table"
+>( tablecolumns%=
text(wi2%,23))
+?, tablecolumnwidth%=
convert_to_OS(24)
+@( tabextrarows%=
text(wi2%,69))
8:format$="label"
+B' Title$="":Title1$="":Title2$=""
+C"
selected_esg(wi2%,5)
28:labup%=1
29:labup%=2
30:labup%=3
53:labup%=4
+H
+I$ labwidth%=
convert_to_OS(32)
+J$ labdepth%=
convert_to_OS(34)
+K$ labrows%=papery%
labdepth%
+L labpage%=labrows%*labup%
+M< startlabel%=
text(wi2%,55))-1:$
text(wi2%,55)="1"
labcount%=startlabel%
+O" labsubst%=-1:labsubfor%=-1
selected(wi2%,39)
S$=$
text(wi2%,78)
+R.
S$<>""
labsubst%=
field(X%,S$,
S$=$
text(wi2%,40)
+T/
S$<>""
labsubfor%=
field(X%,S$,
+U
fixed1$=$
text(wi2%,51)
fixed2$=$
text(wi2%,52)
convert_spacer(S$)
S%,C$
(S$):C$=
+`"
S%=0:
Use spacer$ "as is"
+a"
C$<"0"
C$>"9":S$=
S%,C$)
S%," ")
convert_to_OS(ic%)
N,units$
units$=$
text(printerW%,33)
get current units from label, NOT from selected radio button
text(printerW%,ic%))
units$
"mm":N=N*60*180/1524
"in":N=N*180
"pt":N=N*180/72
convert_units
units$,P%,S$,factor,ic%,N
PROC is only called when radio button clicked. Get NEW units from button
selected_esg(printerW%,8)
+w6
48:units$="mm":factor=60*180/1524:@%=&01020109
+x.
38:units$="in":factor=180:@%=&01020209
+y1
77:units$="pt":factor=180/72:@%=&01020109
14,15,16,18,24,32,34,82,-1
ic%<>-1
convert_to_OS(ic%)
N=N/factor
text(printerW%,ic%)=
redraw_icon(printerW%,ic%)
@%=&90A
label_units(units$)
label_units(U$)
ic%,S$
10,26,33,35,83,-1
ic%<>-1
S$=$
text(printerW%,ic%)
S$)=")"
S$,3)=U$+")"
S$=U$
text(printerW%,ic%)=S$
redraw_icon(printerW%,ic%)
list_head
exit%
"hspace%=0:fspace%=0:maxhead%=0
Printable%=pagelength%
blank_lines(Tmargin%)
format$="label"
header_lines%=Count%:
displayed%=-1
Title2$<>""
send_title(Title2$)
selected(printW%,11)
send_title("Printed: "+
selected(printW%,28)
displayed%=-1
send_title(Title$):
send_title(Title1$)
format$
"horiz":
(
selected_esg(printW%,1)<>36
N
"Wimp_TransferBlock",mytask%,SHheadptr%,mytask%,TextPtr%,LenLine%
store_rec_num(-1)
end_line
hspace%-=90
hspace%-=18
"vert":
"table":
(
selected_esg(printW%,1)<>36
N
"Wimp_TransferBlock",mytask%,SHheadptr%,mytask%,TextPtr%,LenLine%
store_rec_num(-1)
end_line
Count%>Tmargin%
rule:hspace%-=18
header_lines%=0
header_lines%=Count%
hspace%+=header_lines%*36
displayed%>=0
fspace%=0
fspace%=36-
selected(printW%,29)*54+page%*72
pad_line(bytes%,char%)
base%,ptr%,I%
/base%=pointer%:ptr%=base%+LenLine%-bytes%-1
bytes%>0
I%=0
bytes%-2
ptr%?I%=char%
ptr%?(bytes%-1)=32
ptr%?bytes%=10
total_list
reportdest$=""
selected(printW%,29)
blank_lines(1):
L$="Total "+
(printed%)
format$
"horiz":
ctotals(numfirst%)
store_rec_num(-2)
store_string(L$,Lmargin%,
"vert":
store_rec_num(-2)
store_string(L$,Lmargin%,
"table":
ctotals(numfirst%)
store_rec_num(-2)
store_string(L$,Lmargin%,
send_title(T$)
C$,L%,max%,Line$,sp%,brk%
max%=LenLine%-Lmargin%-2
T$<>""
C$=
T$,1):T$=
T$,2)
Line$+=C$:L%+=1
#
" ,;:.-=",C$)>0
sp%=L%
L%=max%
brk%=
!
reportdest$="Printer"
0 w%=
how_wide(Line$,0,0,headerfont%,-1)
$
w%>columnwidth%
brk%=
T$=""
brk%
sp%=0
sp%=L%
brk%
Line$,sp%+1)+T$:Line$=
Line$,sp%):shrink%=
store_rec_num(-2)
pagecolumn%=0
store_string(Line$,Tab%(1),
end_line
(Line$)>maxhead%
maxhead%=
(Line$)
Line$="":L%=0:brk%=
:sp%=0
store_string(S$,pos%,end%)
$(TextPtr%+pos%)=S$
TextPtr%?(pos%+
(S$))=32
end%
end_line
store_rec_num(R%)
0SHrecptr%=
claim_page(recanchor%,Count%*4+4)
!(SHrecptr%+Count%*4)=R%
end_line
TextPtr%?(LenLine%-1)=10
Count%+=1:Printable%-=1
, ;SHtextptr%=
claim_page(textanchor%,(Count%+1)*LenLine%)
TextPtr%+=LenLine%
reportdest$<>"Printer"
I%=Lmargin%
LenLine%-3
TextPtr%?I%=152
store_rec_num(-3)
end_line
blank_lines(lines%)
lines%>0
store_rec_num(-2)
end_line
lines%-=1
blank_columns(lines%,pos%,C$)
lines%>0
store_string(C$,pos%,
lines%-=1
screen_list
SHrecptr%=!recanchor%
,)!!block%=0:block%!4=-Count%*36
,*(block%!8=(LenLine%-1)*16:block%!12=0
"Wimp_SetExtent",listW%,block%
!block%=listW%
"Wimp_GetWindowState",,block%
,.;x%=(block%!12+block%!4)
2:y%=(block%!16+block%!8)
,/"block%!12=block%!4+LenLine%*16
Count%<28
,1" block%!16=block%!8+Count%*36
block%!16=block%!8+36*28
"Wimp_CloseWindow",,block%
open_window(listW%)
Listed%=
lit(listM%,0,
selected(passW%,13))
lit(listM%,2,(format$="horiz"
format$="vert")
shrink%)
sort_textcol%=-1
$SortTextCol%="Sort """""
lit(listM%,1,
show_menu(listM%,x%,y%)
x%+214,y%-20
sort_list(N%,z%)
A%,I%,P%,ind%,type%,L%
N%=-1
selected(queryW%,1)
type%=5
type%=4
,F1SHtextptr%=!textanchor%:SHrecptr%=!recanchor%
ind%=SHtextptr%+Tab%(N%)
,H?SHmisc%=
extend_named_sliding_block(tempanchor%,Count%*4+4)
,I?SHmisc2%=
extend_named_sliding_block(balanchor%,Count%*4+4)
sortfield%>0
L%=len%(sortfield%)
I%=0
Count%-1
SHrecptr%!(I%*4)<0
SHmisc2%!(I%*4)=ind%
,N
,O3 SHmisc2%!(I%*4)=0:SHmisc%!(A%*4)=ind%:A%+=1
sortfield%>0
,Q" byte%=ind%?L%:ind%?L%=13
,R) $ind%=
transform_date(L%,$ind%)
ind%?L%=byte%
,T
ind%+=LenLine%
"OS_HeapSort",A%,SHmisc%,type%
,YFSHsort%=
extend_named_sliding_block(sortanchor%,Count%*LenLine%+4)
,ZBSHtemprec%=
extend_named_sliding_block(flaganchor%,Count%*4+4)
dest%=SHsort%
z%=-1
A%-=1
A%=0
I%=0
Count%-1
ind%=SHmisc2%!(I%*4)
ind%=0
,`" ind%=SHmisc%!(A%*4):A%+=z%
sortfield%>0
,b" byte%=ind%?L%:ind%?L%=13
,c) $ind%=
transform_date(L%,$ind%)
ind%?L%=byte%
,gJ
"Wimp_TransferBlock",mytask%,ind%-Tab%(N%),mytask%,dest%,LenLine%
,h. P%=(ind%-Tab%(N%)-SHtextptr%)
LenLine%
,i( SHtemprec%!(I%*4)=SHrecptr%!(P%*4)
dest%+=LenLine%
"Wimp_TransferBlock",mytask%,SHsort%,mytask%,SHtextptr%,Count%*LenLine%
"Wimp_TransferBlock",mytask%,SHtemprec%,mytask%,SHrecptr%,Count%*4
scrap_block(sortanchor%)
scrap_block(tempanchor%)
scrap_block(balanchor%)
scrap_block(flaganchor%)
redraw(listW%)
lose_list
close_window(listW%)
scrap_block(headanchor%):SHheadptr%=0
scrap_block(textanchor%):SHtextptr%=0
scrap_block(recanchor%):SHrecptr%=0
Listed%=
query
qbe%
parse
search$,F$,G$,FT$,F%,X$,P%,Q%,I%,t$,op$
F%=1
fields%
chartype%(F%)
0,1,2,3,4,63:
F$=$Rf%(F%)
WHEN 41,42,43:
1
IF $Rf%(F%)=" " THEN F$="Y" ELSE F$="N"
F$=""
G$=F$
F$<>""
> X$=">=>=,<=<=,<>,}{,>=,<=,==,>>,<<,{{,=,<,>,{,~,":P%=0
(X$)>0
P%=0
< Q%=
X$,","):op$=
X$,Q%-1):X$=
X$,Q%+1):P%=
F$,op$)
P%=0
F$="="+F$
C
G$<>""""
$Rf%(F%+1)="""":search$+=Tag$(F%)+",":FT$=F$
B
G$=""""
$Rf%(F%+1)<>"""":search$+=Tag$(F%)+FT$+" & "
)
G$="""":search$+=Tag$(F%)+","
&
:search$+=Tag$(F%)+F$+" & "
"$Query%=
search$,
(search$)-3)
parse
qbe(on%,disp%)
on%
& valstatus%=
selected(prefsW%,21)
deselect(prefsW%,21):
val_on_off(
display(key%,-3)
qbe%
@
set_icon(prefsW%,21,valstatus%):
val_on_off(valstatus%)
%
disp%
display(key%,addr)
deselect(matchW%,2)
qbe%=on%
parse
val%,valt%,vals%,C%,I%,P%,F%,f1%,f2%,t%,flag%,left%,right%,search$,field$,op$,bo$,target$,targ$,f$,t$,tt$,E$,E1$,TitFd$,TitTg$,simple%,date$,SF$,S$,case%,targets%,quoted%,ft%
S$=$Query%
u(S$)="ALL"
S$=""
S$=""
query$="ALL"
query$=S$
case%=
selected(queryW%,1)
usekey%=-1:useval$=""
stripright(S$," ")
simple%=
simple(S$)
S$<>""
S$+=" "
Title$=""
(S$)>0
W$=
word(S$," ")
W$="NOT"
S$,1)<>"("
moan_err%,
msg("Err60")
strip_brackets
(W$)>0
W$="&"
W$="AND"
5 flag%=
:TitFd$="":TitTg$="":op$="":targets%=0
5
"AND","OR","NOT":E$=W$:Title$+=" "+E$+" "
E$=""
split
(field$)>0
"
field$,"TIME$")=0
& f$=
word(field$,","))
field$)
f1%=0:f2%=0
6
f$,"TIME$")>0:TitFd$=f$+" ":field$=""
<
f$="@":f1%=1:f2%=fields%:TitFd$="Any field "
f$,"-")>0:
P%=
f$,"-")
* f1%=
field(val%,
f$,P%-1),
! TitFd$=
TitFd$)+"-"
* f2%=
field(val%,
f$,P%+1),
$
f1%>f2%
f1%,f2%
# f1%=
field(val%,f$,
! f$="F$("+
(f1%)+")"
*
case%
f$="FNu("+f$+")"
5
val%
instring%
f$="VAL("+f$+")"
!
chartype%(f1%)
5,50,51,70,71:
L%=len%(f1%)
7 f$="FNtransform_date("+
(L%)+","+f$+")"
targ$=target$
(targ$)>0
quoted%=
:ft%=0
! t$=
word(targ$,",")
flag%
4
quoted%
ft%=
field(valt%,t$,
E
See whether target is a field rather than a literal
ft%
]
selected(printW%,37)
tt$=
expand(t$,link$(f1%),L%,SF$,C%)
tt$=t$
'
case%
u(t$)
1 desc$=$
text(mainW%,desc%(ft%))
1
desc$=""
tt$=t$
tt$=desc$
tt$+="(Field)"
% t$="F$("+
(ft%)+")"
.
case%
t$="FNu("+t$+")"
-
quoted%
tt$=""""+tt$+""""
TitTg$+=tt$+","
targets%+=1
u$=t$
!
chartype%(f1%)
>
41,42,43,61,62:
ft%=0
pos_neg(f1%,t$)
k
5,50,51,70,71:
check_date(f1%,t$,2,date$)=
transform_date(len%(f1%),date$):u$=t$
'
ft%=0
t$=""""+t$+""""
?
(val%
valt%)
instring%
t$="VAL("+t$+")"
f2%>0
val%
T E1$="FNvany("+
(f1%)+","+
(f2%)+","+t$+","""+op$+""","""+bo$+""")"
U
E1$="FNany("+
(f1%)+","+
(f2%)+","+t$+","""+op$+""","""+bo$+""")"
6
E1$=
element(op$,f1%,chartype%(f1%))
E
(E$)+
(E1$)>255
moan_err%,
msg("Err6")
E$+=E1$
E
(E$)+
(bo$)>255
moan_err%,
msg("Err6")
E$+=bo$
flag%=
E$=
(E$)-
(bo$))
E$,bo$)>0
B
(E$)>253
moan_err%,
msg("Err6")
E$="("+E$+")"
add_brackets
(S$)>0
E$+=" "
(search$)+
(E$)>255
moan_err%,
msg("Err6")
search$+=E$
build_title(targets%)
,Title$=
leaf($database%),2)+". "+Title$
usekey%>=0
kl%=KL%(usekey%):val$=
type(usekey%)
MarkedRecs%>0
selected(matchW%,3)
selected(matchW%,8)
filter%=
ticked(markM%,0):
search$=""
search$="base%?REC%=1"
8 Title$=
leaf($database%),2)+". Marked records"
1 search$="("+search$+")"+"ORbase%?REC%=1"
usekey%=-1:useval$=""
) Title$+=" (plus marked records)"
ticked(markM%,1):
search$=""
search$="base%?REC%=0"
-!: Title$=
leaf($database%),2)+". Unmarked records"
-#2 search$="("+search$+")"+"ANDbase%?REC%=0"
-$. Title$+=" (excluding marked records)"
search$=""
search$="TRUE":Title$=
leaf($database%),2)+". All records"
=search$
pos_neg(F%,s$)
u(s$)
chartype%(F%)
41,42,43:
-1C
"Y","YES","T","TRUE","SET","TICKED","
","STAR","*":s$=" "
-2R
"N","NO","F","FALSE","X","CROSS","CLEAR","BLANK","NULL","UNTICKED":s$=""
61,62:
-68
"Y","YES","T","TRUE","SET","TICKED","
":s$=" "
-72
"N","NO","F","FALSE","X","CROSS":s$=
-8]
"CLEAR","BLANK","NULL","MAYBE","DONTKNOW","DONTCARE","WHAT","WHAT?","EH?","?":s$=""
simple(S$)
flag%
-@-
S$," OR ")>0
S$,"NOT ")>0:flag%=
S$,"==")>0:flag%=
-B'
S$,"=")>0
S$,",")=0:flag%=
=flag%
word(
S$,sep$)
P%,Q%,W$
P%+=1
-J
S$,P%,1)=""""
S$,P%,1)=sep$
moan_err%,
msg("Err93")
S$,P%-1)
S$,P%+1)
W$,1)=""""
W$)=""""
W$,2)):quoted%=
element(op$,f%,char%)
E$,fn$
char%
36,39:
fn$="FNinmemo("
op$
-X+
"{":E$=fn$+
(f%)+","+t$+")=TRUE "
-Y1
"}{":E$=fn$+
(f%)+","+t$+")=FALSE "
"=":
-[O
t$=""""""
E$=fn$+
(f%)+","+t$+")=TRUE "
moan_err%,
msg("Err40")
"<>":
-]P
t$=""""""
E$=fn$+
(f%)+","+t$+")=FALSE "
moan_err%,
msg("Err40")
64,65,66,67:
-`R E$="FNinscroll("+
(f%)+","+Scrcol$+","+t$+","""+op$+""","+
(vals%)+")=TRUE "
op$
-c)
"{":E$="INSTR("+f$+","+t$+")>0"
-d*
"}{":E$="INSTR("+f$+","+t$+")=0"
"=":
E$=f$+op$+t$
-g"
simple%=
usekey%=-1
-h! foundkey%=
is_a_key(f%)
foundkey%>0
-j]
KL%(foundkey%)=len%(f%)
case%=case%(foundkey%)
usekey%=foundkey%:useval$=u$
-l
-m,
"$":E$="FNwc("+f$+","+t$+")=TRUE "
-n-
":E$="FNwc("+f$+","+t$+")=FALSE "
:E$=f$+op$+t$
vany(from%,to%,t%,op$,bo$)
F%,found%,v%,bo%
bo%=(bo$="OR")
F%=from%-1
F%+=1:v%=
(F$(F%))
op$
"=":found%=(v%=t%)
"<>":found%=(v%<>t%)
"<":found%=(v%<t%)
">":found%=(v%>t%)
"<=":found%=(v%<=t%)
">=":found%=(v%>=t%)
(bo%=found%)
F%=to%
=found%
any(from%,to%,targ$,op$,bo$)
F%,found%,f$,t$,bo%,case%
case%=
selected(queryW%,1)
bo%=(bo$="OR")
F%=from%-1
F%+=1:f$=F$(F%)
chartype%(F%)
.
41,42,43,61,62:t$=
pos_neg(F%,targ$)
:t$=targ$
case%
u(f$)
op$
"{":
chartype%(F%)
36,39:
found%=
inmemo(F%,t$)
:found%=(
f$,t$)>0)
"}{":
chartype%(F%)
36,39:
# found%=(
inmemo(F%,t$))
:found%=(
f$,t$)=0)
"=":found%=(f$=t$)
"<>":found%=(f$<>t$)
"<":found%=(f$<t$)
">":found%=(f$>t$)
"<=":found%=(f$<=t$)
">=":found%=(f$>=t$)
"$":found%=
wc(f$,t$)
!
":found%=
wc(f$,t$)
(bo%=found%)
F%=to%
=found%
split
X$,Q%,Q1%,Q2%,I%,t$
:X$=">=>=,<=<=,<>,}{,>=,<=,==,>>,<<,{{,=,<,>,{,~,":P%=0
%Q1%=
W$,""""):Q2%=
W$,"""",Q1%+1)
(X$)>0
P%=0
8 Q%=
X$,","):op$=
X$,Q%-1):X$=
X$,Q%+1):P%=
W$,op$)
Q1%>0
P%>Q1%
Q2%>P%
P%=0
P%>0
field$=
W$,P%-1)
target$=
W$,P%+
(op$))+","
field$+=","
op$="~"
op$="<>"
op$
"<>","}{":bo$="AND"
D
op$="<>"
target$,$wc%)>0
target$,$ws%)>0)
op$="
"<=",">=":bo$="OR"
-
"<=<=",">=>=":op$=
op$,2):bo$="AND"
3
"==","<<",">>","{{":op$=
op$,1):bo$="AND"
:bo$="OR"
C
op$="="
target$,$wc%)>0
target$,$ws%)>0)
op$="$"
moan_err%,
msg("Err40")
instring%=
"}{,{{,{",op$)>0
fnum(S$)
S$,1)="X"
concat%=
:=MaxFields%+3+
S$,1)="Y"
concat%=
:=MaxFields%+3+
S$="KK"
concat%=
:=MaxFields%+1
S$="SF"
concat%=
:=MaxFields%+2
("&"+S$)
concat%=((N%
128)>0)
=(N%
127)
field(
val%,f$,Z%)
I%,F%,desc$,flag%
val%=
f$,1)="["
f$)="]"
f$),2):val%=
f$))="#"
Scrcol$=
f$):f$=
f$)):flag%=
I%<fields%
F%=0
I%+=1
u(Tag$(I%))=
u(f$)
F%=I%
F%>0
$ desc$=$
text(mainW%,desc%(F%))
desc$<>""
TitFd$+=desc$
TitFd$+=f$
flag%
TitFd$+="(Column "+Scrcol$+"),"
TitFd$+=","
moan_err%,
msg("Err8,"+f$)
chartype%(F%)
3,6,46,47,54,56,57,74,75,77,78,79:val%=
64,65,66,67:
flag%
Scrcol$="0"
vals%=val%:
val%
val%=
dfield(d$)
I%,F%
I%<fields%
F%=0
I%+=1
text(mainW%,desc%(I%)))=
u(d$)
F%=I%
find_fields(S$,sep$,
tabs$)
f$,F$,C$,L$,P%,Q%,F%,length%,X%
%Q%=1:length%=0:tabs$="":TitFd$=""
P%=
S$,sep$,Q%)
P%>0
S$,Q%,P%-Q%)
F%=
field(X%,f$,
length%+=len%(F%)+2
- L$=
~(len%(F%)+1):
(L$)=1
L$="0"+L$
tabs$+=L$
% F$=
~(F%):
(F$)=1
F$="0"+F$
C$+=F$
Q%=P%+1
length%+=
(RA%))+1
~(length%)
tabs$=L$+tabs$
strip_brackets
W$,1)="("
left%+=1:W$=
W$,2)
W$)=")"
right%+=1:W$=
add_brackets
left%>0
E$="("+E$:left%-=1
right%>0
E$+=")":right%-=1
build_title(T%)
change%
#TitFd$=
TitFd$):TitTg$=
TitTg$)
TitFd$,"TIME$")=0
TitFd$,",")>0
TitFd$,"-")>0)
bo$
&
"OR":TitFd$="One of:"+TitFd$
"AND":
op$
;
"<>":TitFd$="None of:"+TitFd$:op$="=":change%=
;
"}{":TitFd$="None of:"+TitFd$:op$="{":change%=
#
:TitFd$="All of:"+TitFd$
T%>1
bo$
."&
"OR":TitTg$="one of:"+TitTg$
"AND":
op$
.%1
"<>":TitTg$="none of:"+TitTg$:op$="="
.&1
"}{":TitTg$="none of:"+TitTg$:op$="{"
.''
":TitTg$="any of:"+TitTg$
.(I
change%
TitTg$="any of:"+TitTg$
TitTg$="all of:"+TitTg$
.)
op$
"{":op$=" contains "
..%
"}{":op$=" does not contain "
./,
"$":op$=" has wild-card match with "
.07
":op$=" does not have wild-card match with ":
Title$+=TitFd$+op$+TitTg$
expand(string$,table$,
ExpLen%,
subst$,
scrcol%)
p$,s$,start%,F%,I%,ind%,row%,field%,subst%,exact%,pos%,epos%,exp%,P%,T%,Rows%,TabFields%,Rec%,offset%,heading%,colours$
subst$=string$
table$=""
ExpLen%=0:=string$:
### Not linked ###
table$,",")
P%>0
exp%=
table$,P%+1))
table$=
table$,P%-1)
exp%=1
.?*field%=
trailing_number(table$,exact%)
.@*subst%=
leading_number(scrcol%,table$)
### field% is the linked field, subst% (if >=0) is the one to substitute on entry ###
table_number(table$)
T%<0
ExpLen%=0:=string$:
### Table not found ###
p$=printrel$(T%)
.E`NewTab%=(
table_info(T%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)="
exp%>TabFields%
exp%=1
TabFields%=0
ExpLen%=0:=string$:
### Nothing to expand to! ###
.H*extra%=-NewTab%*(Rows%*(TabFields%+1))
subst%>=0
pos%=
table_field(subst%,tabfieldlen%())
pos%=
table_field(field%,tabfieldlen%())
p$<>""
ExpLen%=0
I%=1
(p$)
F%=
p$,I%,3))
.N# ExpLen%+=tabfieldlen%(F%)+2
ExpLen%-=2
.Q"
ExpLen%=tabfieldlen%(exp%)
.S6start%=SHtabptr%(T%)+offset%-Rec%:ind%=start%+pos%
row%+=1:ind%+=Rec%
row%>Rows%
$ind%=subst$
row%>Rows%
subst$="":=string$:
## String not in table ###
.X;ind%=start%+row%*Rec%:
subst%>=0
subst$=$(ind%+pos%)
p$<>""
I%=1
(p$)
F%=
p$,I%,3))
.\, pos%=
table_field(F%,tabfieldlen%())
.]4 s$+=
pad($(ind%+pos%),tabfieldlen%(F%))+" "
s$=
.a- epos%=
table_field(exp%,tabfieldlen%())
.b5 ind%+=epos%:s$=$ind%:
### Return 2nd field ###
n(F%)
T%,row%,ind%,start%,Rows%,Rec%,TabFields%,pos%,valpos%,N%,field%,subst%,table$,S$,exact%,scrcol%
link$(F%)=""
S$=$Rf%(F%)
table$=link$(F%)
.k*field%=
trailing_number(table$,exact%)
.l*subst%=
leading_number(scrcol%,table$)
.m/table%=
table_number(table$):
table%<0
.nYT$=
table_info(table%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)
TabFields%=field%
softerror("",54):=0
subst%>0
.q. pos%=
table_field(subst%,tabfieldlen%())
.r0
pos%=
table_field(field%,tabfieldlen%())
.t1valpos%=
table_field(field%+1,tabfieldlen%())
.u)start%=SHtabptr%(table%)+offset%-Rec%
row%+=1
.w ind%=start%+row%*Rec%+pos%
row%>Rows%
S$=$ind%
row%<=Rows%
.z# ind%=start%+row%*Rec%+valpos%
N%=
($ind%)
N%=0
pad(s$,L%)
L%," "),L%)
padL(s$,L%)
L%," ")+s$,L%)
stripright(s$,c$)
s$)=c$
s$=
trim(wi%,ic%)
selected(prefsW%,42)
text(wi%,ic%)=
stripright($
text(wi%,ic%)," ")
redraw_icon(wi%,ic%)
include_fields
Hdlen%,Datlen%,hlm%,dlm%,I%,F%,f$,Head$,limit%,pad%,col%,fail%,n$,y$,S$,SF$,pos%,width%,pending%,first%,tail%,tail$,last%,N%,S%,V%,w%,memo%,scroll%,scrcol%
nosort%=
numfirst%=
margin_check
pos%=Lmargin%
numeric%()=
#maxlen%(MaxFields%+1)=KL%(key%)
first%=
:last%=
(Form$)-1
I%=1
last%
& F%=
fnum(
Form$,I%,2)):scroll%=
N%+=1
Tab%(N%)=pos%
selected(printW%,46)
F$=$
text(printW%,44)
I
F$=Tag$(F%)
(F$)=N%
sorton%=N%:Title1$+=
msg("Err201,"+F$)
V%=chartype%(F%)
F%=0
F%=MaxFields%+2
V%=3:
Justify record & subfile numbers
selected(printW%,5)
7 f$=
expand("@#*",link$(F%),Datlen%,SF$,scrcol%)
Datlen%=maxlen%(F%)
C
36,39:memo%=
set_format("vert"):maxlen%(F%)=0:Datlen%=0
3
41,42,43,61,62:maxlen%(F%)=
no_yes(F%,F$)
64,65,66,67:
= S%=
scroller_number(F%):scroll%=
:scrcol%(S%)=scrcol%
ScrollForm$
M
"R":maxlen%(F%)=
max_scroller_length(S%,F%,V%-63,scrcol%,Datlen%)
R
"C":maxlen%(F%)=
max_row_length(S%,F%,V%-63,scrcol%,Datlen%):nosort%=
Datlen%=0
Datlen%=0
Datlen%=maxlen%(F%)
maxlen%(F%)=Datlen%
selected_esg(printW%,1)
3
1:Head$=Tag$(F%):tail%=2:tail$=":"+
(160)
D
V%>250
Head$=Tag$(F%)
Head$=$
text(mainW%,(desc%(F%)))
tail%=2:tail$=":"+
(160)
*
36:Head$="":tail%=1:tail$=
(160)
F%=0
Head$="RECORD":Datlen%=6
F%=MaxFields%+1
Head$="KEY":Datlen%=KL%(key%)
F%=MaxFields%+2
Head$="SUBFILE":Datlen%=1
Hdlen%=
(Head$)
Hdlen%>hlm%
hlm%=Hdlen%
Datlen%>dlm%
dlm%=Datlen%
concat%
first%:
5 width%=Datlen%+
(spacer$):pending%=
:first%=
+
reportdest$="Printer"
width%+=2
concat%
(I%<last%):
: width%+=Hdlen%+tail%+Datlen%+
(spacer$):pending%=
+
reportdest$="Printer"
width%+=2
pending%:
$ width%+=Hdlen%+tail%+Datlen%
#
width%>dlm%
dlm%=width%
pending%=
:first%=
%
Hdlen%>hlm%
hlm%=Hdlen%
format$
"horiz","table":
! PrintFields%=
(Form$)
- pad%=Datlen%-Hdlen%:
pad%<0
pad%=0
+
I%<last%
Ls%=
(spacer$)
Ls%=0
B SHheadptr%=
claim_page(headanchor%,pos%+pad%+Hdlen%+Ls%+4)
2
3,6,46,47,54,56,57,74,75,77,78,79,254:
numeric%(N%)=
I $(SHheadptr%+pos%+pad%)=Head$:?(SHheadptr%+pos%+pad%+Hdlen%)=32
A
:$(SHheadptr%+pos%)=Head$:?(SHheadptr%+pos%+Hdlen%)=32
!
reportdest$="Printer"
N maxlenP%(N%)=
how_wide("",SHheadptr%+pos%,Hdlen%+Ls%,headerfont%,-1)
pos%+=pad%+Hdlen%+Ls%
"vert":
PrintFields%=2
!
reportdest$="Printer"
6 w%=
how_wide(Head$+tail$,0,0,headerfont%,-1)
+
w%>maxlenP%(1)
maxlenP%(1)=w%
M
100,254,255:
key,record number,or calculation included. Do nothing
1
vtype$(V%)="L"
scrolldata%(S%,9)=N%
truelen%(F%)=Hdlen%
truelen%(F%)>maxlen%(F%)
maxlen%(F%)=truelen%(F%)
Tab%(N%+1)=pos%
format$
"horiz","table":LenLine%=pos%+2
"vert":Tab%(1)=Lmargin%:Tab%(2)=hlm%+tail%+Tab%(1):Tab%(3)=0
memo%
)
TextLine%>dlm%
dlm%=TextLine%
M
TextLine%=0
TextLine%=dlm%:
TextLine% will be 0 if 'A' specified
:
TextLine%>254
softerror("",223):TextLine%=254
LenLine%=Tab%(2)+dlm%+2
"label":LenLine%=0
no_yes(F%,
P%,Q%,V$,L%,no$,yes$,what$
val(mainW%,field%(F%))
V$,"Q")
P%>0
+ Q%=
V$,";S"):V$=
V$,P%+1,Q%-P%-1)+","
, P%=
V$,","):no$=
V$,P%-1):V$=
V$,P%+1)
- P%=
V$,","):yes$=
V$,P%-1):V$=
V$,P%+1)
P%=
V$,",")
P%>0
what$=
V$,P%-1)
no$="N":yes$="Y":what$=""
" ":F$=yes$
(0):F$=no$
chartype%(F%)
41,42,43:F$=no$
61,62:F$=what$
(no$)
(yes$)>L%
(yes$)
set_format(S$)
deselect(printW%,
selected_esg(printW%,3))
deselect(printerW%,
selected_esg(printerW%,2))
"horiz":
select(printW%,15)
"vert":
select(printW%,16)
"table":
select(printerW%,7)
"label":
select(printerW%,8)
format$=S$
save_selection
P%,T%,I%,F%,J%
/"-P%=savebuff%:$P%=printorder$:P%+=
($P%)+1
T%=0
LastTable%
/$# $P%=printrel$(T%):P%+=
($P%)+1
$P%="***":P%+=
($P%)+1
I%=1
(printorder$)-1
/(" F%=
fnum(
printorder$,I%,2))
chartype%(F%)
/*,
3,6,46,47,54,56,57,74,75,77,78,79:
J%=0
/,N
selected(numscrollW%,(calcrow%?F%)*8-6+J%)
$P%="ON"
$P%="OFF"
P%+=
($P%)+1
Ecalc%>0
I%=0
Ecalc%-1
J%=0
/4+ $P%=ephemera$(I%,J%):P%+=
($P%)+1
/88Start%=savebuff%:End%=Start%+P%-savebuff%:Type%=&7F3
load_selection(f$)
F%,I%,J%,T%,F,new%,p$
clear_selection
printorder$=
printorder$,3)="!!!"
!Pcol%=
printorder$,4)):printorder$=
T%=-1:printrel$()=""
p$<>"***"
T%+=1
p$=
p$<>""
p$<>"***"
select(printW%,5)
printrel$(T%)=p$
tableW%(T%)>0
/If NewTab%=(
table_info(T%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)="
/J0 extra%=-NewTab%*(Rows%*(TabFields%+1))
I%=1
(p$)
/L$ tablefield%=
p$,I%,3))
/M3
select(tableW%(T%),tablefield%+extra%)
/O
select_them(
Ecalc%=0
F%=MaxFields%+3+Ecalc%
J%=0
S$=
ephemera$(Ecalc%,J%)=S$
J%=2
Tag$(F%)=S$
/Z1
J%=3
len%(F%)=
(S$):maxlen%(F%)=
/[$
J%=4
chartype%(F%)=
Ecalc%+=1
close_file(F)
lit(printM%,7,
lit(printM%,8,
lit(printM%,9,
lit(mainM%,7,
selected(passW%,13))
select_them(calc%)
F%,I%,J%,S%,col%
I%=1
(printorder$)-1
/i" F%=
fnum(
printorder$,I%,2))
select(matchW%,4)
/l)
MaxFields%+1:
select(matchW%,6)
/m*
MaxFields%+2:
select(matchW%,12)
chartype%(F%)
36,60:
/q0 col%=
get_icon_cols(mainW%,field%(F%))
/r2 col%=((col%>>4)
(col%<<4))
%11111111
/s7
set_icon_cols(mainW%,field%(F%),col%)
41,42,43,61,62:
/u0 col%=
get_icon_cols(mainW%,field%(F%))
/v2 col%=((col%>>4)
(col%<<4))
%11111111
/w0
set_icon_cols(mainW%,field%(F%),col%)
/x.
3,6,46,47,54,56,57,74,75,77,78,79:
/y$
select(mainW%,field%(F%))
/z$
enable_row(calcrow%?F%,
calc%
J%=0
/}N
set_icon(numscrollW%,(calcrow%?F%)*8-6+J%,(
#F="ON"))
64,65,66,67:
$
select(mainW%,field%(F%))
! S%=
scroller_number(F%)
&
J%=0
scrolldata%(S%,6)-1
&
invert(scrollerW%(S%),J%)
9
F%<=MaxFields%
select(mainW%,field%(F%))
select_range(first%,last%,show%)
F%,T%,F$,wi%,ic%,icon%,handle%
first%>last%
first%,last%
first%=1
last%=fields%
printorder$=""
printorder$=
printorder$))
wi%=mainW%
F%=first%
last%
ic%=field%(F%)
chartype%(F%)
41,42,43,61,62:
$ col%=
get_icon_cols(wi%,ic%)
F
(col%
%1111)>=2
col%=((col%>>4)
(col%<<4))
%11111111
.
show%
set_icon_cols(wi%,ic%,col%)
' F$=
~(F%):
(F$)=1
F$="0"+F$
printorder$+=F$
K
0,1,2,4,5,7,8,39,48,49,50,51,52,53,55,58,63,68,69,70,71,72,73,76:
=
len%(F%)>0
get_icon_cols(wi%,ic%)<>winback%*17
) F$=
~(F%):
(F$)=1
F$="0"+F$
printorder$+=F$
$
show%
select(wi%,ic%)
,
3,6,46,47,54,56,57,74,75,77,78,79:
=
len%(F%)>0
get_icon_cols(wi%,ic%)<>winback%*17
) F$=
~(F%):
(F$)=1
F$="0"+F$
printorder$+=F$
$
show%
select(wi%,ic%)
$
enable_row(calcrow%?F%,
36,60:
' F$=
~(F%):
(F$)=1
F$="0"+F$
printorder$+=F$
$ col%=
get_icon_cols(wi%,ic%)
0 col%=((col%>>4)
(col%<<4))
%11111111
.
show%
set_icon_cols(wi%,ic%,col%)
64,65,66,67:
select(wi%,ic%)
S%=
scroller_number(F%)
handle%=scrollerW%(S%)
'
icon%=0
scrolldata%(S%,6)-1
select(handle%,icon%)
icon%
' F$=
~(F%):
(F$)=1
F$="0"+F$
printorder$+=F$
lit(printM%,7,
lit(printM%,8,
lit(mainM%,7,
selected(passW%,13))
shade(matchW%,7,printorder$<>"")
lit(printM%,9,printorder$<>"")
clear_selection
F%,T%,new%,wi%,ic%
F%=1
fields%
chartype%(F%)
(
Filter button: do nothing
36,41,42,43,60,61,62:
. col%=
get_icon_cols(mainW%,field%(F%))
E
(col%
%1111)<2
col%=((col%>>4)
(col%<<4))
%11111111
.
set_icon_cols(mainW%,field%(F%),col%)
,
3,6,46,47,54,56,57,74,75,77,78,79:
?
enable_row(calcrow%?F%,
deselect(mainW%,field%(F%))
64,65,66,67:
$
deselect(mainW%,field%(F%))
S%=
scroller_number(F%)
wi%=scrollerW%(S%)
%
ic%=0
scrolldata%(S%,6)-1
deselect(wi%,ic%)
&
deselect(mainW%,field%(F%))
printorder$=""
T%=-1
T%<LastTable%
T%+=1
b NewTab%=(
table_info(T%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)="
, extra%=-NewTab%*(Rows%*(TabFields%+1))
p$=printrel$(T%)
p$<>""
tableW%(T%)>0
I%=1
(p$)
$ tablefield%=
p$,I%,3))
5
deselect(tableW%(T%),tablefield%+extra%)
printrel$()=""
ephemera$()="":Ecalc%=0
lit(printM%,7,
lit(printM%,8,
lit(printM%,9,
lit(mainM%,7,
shade(matchW%,7,
deselect(matchW%,4):
deselect(matchW%,6):
deselect(matchW%,12)
load_query(f$,wi%,ic%)
wi%
mainW%:
ic%
F
field%(buttonfield%(0,22)):
select(wi%,ic%):
filter(wi%,4,
.
selected(passW%,14)
match(0,0)
keypadW%:
select(wi%,22):
filter(wi%,4,
7
File double-click; not dropped on window
6 !block%=queryW%:
"Wimp_GetWindowState",,block%
((block%!32)
(1<<16))=0
match(0,0)
"OS_File",255,f$,Query%
query$=$Query%
set_caret(0,queryW%,0)
redraw_icon(queryW%,0)
design_field(b%,ic%,menu%)
w%,h%,bg%,wht%,F%
close_window(createW%)
fields%>0
$ fieldsM%=
field_menu(items%,0)
9 ptr%=designM%+52:ptr%!4=fieldsM%:
lit(designM%,1,
lit(designM%,1,
$Reformatted%<>""
lit(designM%,7,
lit(designM%,2,
lit(designM%,3,
lit(designM%,4,
lit(designM%,5,
adjust%:
live%()=19,20,-1
F%=
get_field(ic%)
chartype%(F%)
2
64,65,66,67:
enable(createW%,
):wht%=730
&
enable(createW%,
):wht%=640
P live%()=11,18,21,22,23,24,35,47,6,26,30,39,40,48,54,-1:
enable(createW%,
' live%()=29,-1:
enable(createW%,
B live%()=30,-1:
enable(createW%,(len%(F%)=0
dbtype$="new"))
A live%()=55,-1:
enable(createW%,(vtype$(chartype%(F%))="E"))
set_icon(createW%,55,(mandatory%?F%=1))
set_icon(createW%,63,(displayit%?F%=1))
dbtype$="new"
8 live%()=22,23,48,54,21,35,-1:
enable(createW%,
- live%()=18,-1:
enable(createW%,ic%<0)
0 . live%()=29,-1:
enable(createW%,ic%>=0)
ic%>=0:
0#* live%()=11,18,-1:
enable(createW%,
0$M live%()=21,22,23,24,35,47,48,6,26,29,30,39,40,54,-1:
enable(createW%,
0&0 live%()=29,30,39,40,-1:
enable(createW%,
0'G live%()=21,22,23,24,35,47,48,6,26,11,18,54,-1:
enable(createW%,
0)!posx%=x%:posy%=y%:dragbutt%=0
0*3!block%=mainW%:
"Wimp_GetWindowState",,block%
x%+=block%!20-block%!4
y%+=block%!24-block%!16
0-5!block%=createW%:
"Wimp_GetWindowState",,block%
0.%closed%=((block%!32
(1<<16))=0)
%1111111
00.
1,1024:
fields%=0
softerror("",62)
ic%>=0
03( fieldfunc$="create":$InsText%=""
045
deselect(createW%,
selected_esg(createW%,1))
set_up_edit
close_window(createW%)
071
position_window(createW%,0,0,0,wht%,0,0)
08
set_caret(0,createW%,4)
09
closed%
0<C
(ic%
2)=1
drag%=6:dragbutt%=16
drag%=5:dragbutt%=64
0=$
init_drag(mainW%,ic%,drag%)
0@%
shade(createW%,44,(fields%>0))
0A& fieldfunc$="create":$InsText%=""
0B3
deselect(createW%,
selected_esg(createW%,1))
0C#
shade(createW%,49,snapgrid%)
0D-
ic%<0
set_up_create
set_up_edit
close_window(createW%)
menu%
0G+
show_menu(designM%,posx%-64,posy%)
0HL
position_window(createW%,0,0,0,wht%,0,0):
set_caret(0,createW%,4)
0J<
closed%
init_drag(mainW%,ic%,5):dragbutt%=64
enable(wi%,on%)
shade(wi%,live%(I%),on%)
I%+=1
live%(I%)=-1
set_up_edit
adjust%
live%()=21,54,24,22,47,35,23,48,-1:
enable(createW%,
lit(designM%,0,
0Y.Fieldnumber%=
get_field(ic%):oldfield%=ic%
0Z!type%=chartype%(Fieldnumber%)
(ic%
2)=0
Tag$(Fieldnumber%)<>""
ic%+=1
0\>!block%=mainW%:block%!4=ic%:
"Wimp_GetIconState",,block%
0]Ix%=block%!8:y%=block%!12:w%=block%!16-block%!8:h%=block%!20-block%!12
(oldfield%
2)=0
Tag$(Fieldnumber%)=""
x%+=w%:w%=0:h%=0
0_7$boxX%=
(x%):$boxY%=
(y%):$boxW%=
(w%):$boxH%=
0`'wht%=640:
set_scroll_def(0,0,
vtype$(type%)
0bE
"E":
shade(createW%,21,
select(createW%,21):
set_limits(0)
0cE
"C":
shade(createW%,47,
select(createW%,47):
set_limits(1)
0dE
"T":
shade(createW%,24,
select(createW%,24):
set_limits(2)
0eE
"X":
shade(createW%,22,
select(createW%,22):
set_limits(3)
0fE
"K":
shade(createW%,23,
select(createW%,23):
set_limits(4)
0gE
"O":
shade(createW%,48,
select(createW%,48):
set_limits(5)
0hE
"S":
shade(createW%,35,
select(createW%,35):
set_limits(6)
0iR
"L":wht%=730:
set_scroll_def(Fieldnumber%,type%-63,adjust%
(ic%>0),
0j?
shade(createW%,54,
select(createW%,54):
set_limits(7)
I%=0
lit(ftypeM%(6),I%,
0n$
I%<8
lit(ftypeM%(0),I%,
0o$
I%=5
lit(ftypeM%(3),I%,
0q$fieldtype%=type%:currenttype%=-1
currenttype%+=1
?(flist%(menunumber%)+currenttype%+1)=fieldtype%
currenttype%>lasttype%
currenttype%>lasttype%
softerror(
(fieldtype%),221):
tick_one(ftypeM%(menunumber%),0,lasttype%-1,currenttype%)
0w0$FtitleText%="Modify field "+
(Fieldnumber%)
0x1$DescText%=$
text(mainW%,desc%(Fieldnumber%))
0y $TagText%=Tag$(Fieldnumber%)
0z#$LenText%=
(len%(Fieldnumber%))
0{ $ValText%=vname$(fieldtype%)
deselect(createW%,
selected_esg(createW%,2))
fix%(Fieldnumber%)
0~+
select(createW%,45):$Fixpt%="0"
select(createW%,46):$Fixpt%="0"
select(createW%,14):$Fixpt%=
(fix%(Fieldnumber%))
&num%=(fieldtype%=3
fieldtype%=6)
shade(createW%,13,(
selected(createW%,14)))
shade(createW%,14,num%)
shade(createW%,45,num%)
shade(createW%,46,num%)
shade(createW%,6,
shade(createW%,63,
fieldtype%
0,1,2,3,4,5,6,7,8,46,47,63:
shade(createW%,6,
adjust%)
36,37,38,60:
shade(createW%,63,
shade(createW%,15,(fieldtype%=3
fieldtype%=47))
shade(createW%,25,(fieldtype%=3))
&C$=calc$(Fieldnumber%):P%=
C$,"|")
P%>0
- $mintext%=
C$,P%-1):$maxtext%=
C$,P%+1)
$mintext%="":$maxtext%=""
$DesAction%="Edit field..."
set_up_create
select(createW%,21):
set_limits(0)
lit(designM%,0,
adjust%)
adjust%
dbtype$="new"
lit(designM%,0,
lit(ftypeM%(3),5,
I%=0
lit(ftypeM%(6),I%,
-
I%<8
I%>0
lit(ftypeM%(0),I%,
lit(ftypeM%(3),5,
I%=0
lit(ftypeM%(6),I%,
-
I%<8
I%>0
lit(ftypeM%(0),I%,
3$boxX%=
(x%):$boxY%=
(y%):$boxW%="0":$boxH%="0"
*$FtitleText%="New field "+
(fields%+1)
+$DescText%="":$TagText%="":$LenText%=""
)$Fixpt%="2":$mintext%="":$maxtext%=""
deselect(createW%,
selected_esg(createW%,2))
select(createW%,46)
!$DesAction%="Create field..."
empty_list
L%,S$
%S$="No matching records":L%=
store_rec_num(-2)
store_string(S$,Lmargin%,
L%>maxhead%
maxhead%=L%
#vrules%=
:spacer$=" ":nosort%=
remove_field(Field%,con%)
F%,scrap%
con%
confirm(
msg("Err53"))=
)!block%=mainW%:block%!4=desc%(Field%)
"Wimp_GetIconState",,block%
"posx%=block%!8:posy%=block%!12
"Wimp_DeleteIcon",,block%
block%!4=field%(Field%)
"Wimp_DeleteIcon",,block%
Create two spurious fields to prevent nudge & adjust changing icon number!
;scrap%=
create_icon(0,mainW%,0,0,0,0,&701A731,"",0,0,0)
;scrap%=
create_icon(0,mainW%,0,0,0,0,&701A731,"",0,0,0)
fields%-=1
Calc$=calc$(Field%)
F%=Field%
fields%
desc%(F%)=desc%(F%+1):field%(F%)=field%(F%+1):Tag$(F%)=Tag$(F%+1):len%(F%)=len%(F%+1):chartype%(F%)=chartype%(F%+1):fix%(F%)=fix%(F%+1):calc$(F%)=calc$(F%+1)
calc$(fields%+1)=""
!block%=mainW%
"Wimp_GetWindowState",,block%
;posx%-=block%!20-block%!4:posy%-=block%!24-block%!16-48
"Wimp_ForceRedraw",-1,block%!4,block%!8,block%!12,block%!16
create_field(Before%,x%,y%,update%,
ok%)
Desc%,tag$,Len%,Char%,F%,L%,LF%,OL%,x%,y%,width%,height%,dflg%,menflag%,F,chars%,N%,menufield%
wimp_error(
fields%=MaxFields%
moan_err%,
msg("Err23,"+
(MaxFields%))
$DescText%=""
$TagText%=""
fieldtype%<=8
moan_err%,
msg("Err149")
($DescText%):LF%=
($LenText%)
L%=0
dflg%=(winback%<<28)+&701A711
dflg%=(winback%<<28)+&701A731
fieldtype%<>60
LF%>246
moan_err%,
msg("Err64")
($boxX%):y%=
($boxY%):int%=
($Gridsnap%):
snap(x%,y%,int%)
&width%=
($boxW%):height%=
($boxH%)
fieldtype%
39,40,59:
LF%=0
width%=0
width%=100
height%=0
height%=100
35,44,64,65,66,67:LF%=0
4,41,42,43,61,62,74,79:LF%=1
8,48,50,68,70:LF%=8
49,69:LF%=15
51,71:LF%=10
52,58,72:LF%=24
53,55,73,76:LF%=3
54,56,75,77:LF%=2
57,78:LF%=4
60:LF%=RLmax%
adjust%
OL%=len%(update%)
LF%>OL%:
?
moan_err%,
msg("Err174,"+
(LF%)+","+
(len%(update%)))
LF%<OL%:LF%=OL%
vtype$(fieldtype%)
"K":
Keypad button fields: do nothing here
fieldtype%
E
32,33,34,45,59:
Print, Menu, Exit, Quit & Logo. Do nothing
>
LF%>0
$TagText%=""
moan_err%,
msg("Err16")
8
Allow Unrestricted fields to be used as labels
4
$TagText%=""
moan_err%,
msg("Err16")
F%+=1
$TagText%=Tag$(F%)
F%>fields%
F%=update%:
Do nothing
fieldtype%=33
$TagText%=Tag$(F%)
$TagText%<>"":menufield%=F%
F%<=fields%
$TagText%<>"":
moan_err%,
msg("Err20")
update%>0
remove_field(update%,
fieldtype%=33
menflag%=
8fields%+=1:Tag$(fields%)=$TagText%:len%(fields%)=LF%
fieldtype%
64,65,66,67:
cols%=fieldtype%-63
) height%=
text(createW%,56))*44+6
. f$=$database%+"."+Tag$(fields%)+"scroll"
"OS_File",8,f$
(f$+".Format")
I%=1
cols%
$ N%=
text(createW%,I%+56))
chars%+=N%+1
close_file(F)
"OS_File",18,f$+".Format",&fff
3 width%=
guess_width(chars%,fieldtype%,width%)
width%=0
$TagText%<>""
c
len%(fields%)<70
width%=
guess_width(len%(fields%),fieldtype%,width%)
width%=70*16+16
height%=0
width%>0
height%=48
!chartype%(fields%)=fieldtype%
fieldtype%
1 *
3,6,46,47,54,56,57,74,75,77,78,79:
1"1
selected(createW%,45):fix%(fields%)=-1
1#9
selected(createW%,14):fix%(fields%)=
($Fixpt%)
:fix%(fields%)=0
:fix%(fields%)=0
1(%dwidth%=
string_width($DescText%)
1)=SHformptr%=
claim_page(formanchor%,Fptr%-SHformptr%+L%+1)
1*\desc%(fields%)=
create_icon(0,mainW%,x%-dwidth%,y%+2,dwidth%,44,dflg%,"",Fptr%,hand%,L%)
1+!$Fptr%=$DescText%:Fptr%+=L%+1
$Fptr%=""
fieldtype%
min$=$mintext%
max$=$maxtext%
11N
min$<>""
max$<>""
calc$(fields%)=min$+"|"+max$
calc$(fields%)=""
calc$(0)="LOADED"
14) min$=$mintext%:
min$=""
min$="0"
15* max$=$maxtext%:
max$=""
max$=min$
16" calc$(fields%)=min$+"|"+max$
calc$(0)="LOADED"
fieldtype%
0,1,2,3,4,5,6,7,8,39,46,47,48,49,50,51,52,53,54,55,56,57,58,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79:valptr%=hand%
1<+
40:$Fptr%="file_ff9":valptr%=1:L%=8
1=2
59:valptr%=SHlogoptr%:$Fptr%=Tag$(fields%)
1>#
:valptr%=hvalid%(fieldtype%)
1@=SHformptr%=
claim_page(formanchor%,Fptr%-SHformptr%+L%+1)
1AVfield%(fields%)=
icon_design(fields%,fieldtype%,x%,y%,width%,height%,valptr%,L%,
redraw_icon(mainW%,desc%(fields%)):
redraw_icon(mainW%,field%(fields%))
Before%<fields%
Before%>0
re_sequence(fields%,Before%,-1)
selected(createW%,55)
mandatory%?Before%=1
mandatory%?Before%=0
selected(createW%,63)
displayit%?Before%=1
displayit%?Before%=0
menflag%
copy_menu_file
1G ok%=
copy_menu_file
field%,f$,d%,F,tag$,m$,forbidden$,I%,P%
Before%=0
field%=fields%
field%=Before%
forbidden$=" $&%@\^:.#*|"
menufield%=0
1OB menufield%=
($TagText%):
menufield%=0
menufield%=field%-1
1Q&V$=vtype$(chartype%(menufield%))
V$<>"E"
V$<>"L"
Tag$(field%)="":$TagText%="":
moan_err%,
msg("Err148")
1SN$TagText%=Tag$(menufield%):Tag$(field%)=$TagText%:
redraw_icon(createW%,5)
m$=Tag$(menufield%)
I%=1
P%=
forbidden$,
m$,I%,1))
P%>0
m$,I%,1)="_"
"OS_File",8,$database%+".Menus"
1Z%f$=$database%+".Menus."+m$+"Menu"
"OS_File",5,f$
d%=0
oldmenu%
1^J
"OS_CLI","Copy <Pbase$Dir>.Resources.UserMenu "+f$+" ~CF~V"
1`$
"OS_File",5,oldmenu$
1a6
d%=1
"OS_CLI","Rename "+oldmenu$+" "+f$
snap(
y%,int%)
X%,Y%
snapgrid%=
int%>0
1i5 X%=(x%
int%)*int%:
x%-X%>int%
X%+=int%
1j5 Y%=(y%
int%)*int%:
Y%-y%>int%
Y%-=int%
$boxX%=
(X%):$boxY%=
x%=X%:y%=Y%
snap_all
ic%,x%,y%,w%,h%
ic%=0
2*fields%-1
1s) !iconblock%=mainW%:iconblock%!4=ic%
1t(
"Wimp_GetIconState",,iconblock%
1u& x%=iconblock%!8:y%=iconblock%!12
1v- w%=iconblock%!16-x%:h%=iconblock%!20-y%
1w
snap(x%,y%,
($Gridsnap%))
1x) iconblock%!8=x%:iconblock%!16=x%+w%
1y* iconblock%!12=y%:iconblock%!20=y%+h%
iconblock%!4=mainW%
1{> !block%=mainW%:block%!4=ic%:
"Wimp_DeleteIcon",,block%
1|(
"Wimp_CreateIcon",,iconblock%+4
redraw(mainW%)
nudge(b%,ic%)
int%,z%
b%=4
z%=1
z%=-1
snapgrid%
int%=
($Gridsnap%)
int%=2
-!iconblock%=mainW%:iconblock%!4=oldfield%
"Wimp_GetIconState",,iconblock%
$x%=iconblock%!8:y%=iconblock%!12
+w%=iconblock%!16-x%:h%=iconblock%!20-y%
ic%
50:y%+=int%*z%
51:y%-=int%*z%
52:x%+=int%*z%
53:x%-=int%*z%
'iconblock%!8=x%:iconblock%!16=x%+w%
(iconblock%!12=y%:iconblock%!20=y%+h%
iconblock%!4=mainW%
B!block%=mainW%:block%!4=oldfield%:
"Wimp_DeleteIcon",,block%
"Wimp_ForceRedraw",mainW%,x%-int%,y%-int%,x%+w%+int%*2,y%+h%+int%*2
"Wimp_CreateIcon",,iconblock%+4
(oldfield%
2)=0
x%+=w%:w%=0:h%=0
7$boxX%=
(x%):$boxY%=
(y%):$boxW%=
(w%):$boxH%=
ic%=7
redraw_icon(createW%,ic%)
adjust_field(b%)
Dptr%,Fptr%,L%,dflg%,deficit%,extra%
"Wimp_GetPointerInfo",,block%
newx%=!block%:newy%=block%!4
#Fieldnumber%=
get_field(ficon%)
(ficon%
2)=0
C !block%=mainW%:block%!4=ficon%:
"Wimp_GetIconState",,block%
. Dptr%=block%!28:Desc$=$Dptr%:L%=
(Desc$)
L%=0
dflg%=(winback%<<28)+&701A711
dflg%=(winback%<<28)+&701A731
"Wimp_DeleteIcon",,block%
"Wimp_GetWindowState",,block%
- x%=block%!20-block%!4+newx%-oldx%+minx%
. y%=block%!24-block%!16+miny%+newy%-oldy%
snap(x%,y%,
($Gridsnap%))
f desc%(Fieldnumber%)=
create_icon(0,mainW%,x%,y%,
string_width(Desc$),44,dflg%,"",Dptr%,hand%,L%)
C !block%=mainW%:block%!4=ficon%:
"Wimp_GetIconState",,block%
Fptr%=block%!28
$
"Wimp_DeleteIcon",,block%
(
"Wimp_GetWindowState",,block%
# x%=block%!20-block%!4+minx%
0 y%=block%!24-block%!16+miny%+newy%-oldy%
"
snap(x%,y%,
($Gridsnap%))
F width%=maxx%-minx%+newx%-oldx%:height%=maxy%-miny%+oldy%-newy%
' keepwith%=
selected(prefsW%,16)
keepwith%
I !block%=mainW%:block%!4=ficon%-1:
"Wimp_GetIconState",,block%
2 Dptr%=block%!28:Desc$=$Dptr%:L%=
(Desc$)
P
L%=0
dflg%=(winback%<<28)+&701A711
dflg%=(winback%<<28)+&701A731
&
"Wimp_DeleteIcon",,block%
C !block%=mainW%:block%!4=ficon%:
"Wimp_DeleteIcon",,block%
keepwith%
& dwidth%=
string_width(Desc$)
*
"Wimp_GetWindowState",,block%
9 x%=block%!20-block%!4+newx%-oldx%+minx%-dwidth%
2 y%=block%!24-block%!16+miny%+newy%-oldy%
$
snap(x%,y%,
($Gridsnap%))
_ desc%(Fieldnumber%)=
create_icon(0,mainW%,x%,y%+2,dwidth%,44,dflg%,"",Dptr%,hand%,L%)
(
"Wimp_GetWindowState",,block%
/ x%=block%!20-block%!4+newx%-oldx%+minx%
0 y%=block%!24-block%!16+miny%+newy%-oldy%
"
snap(x%,y%,
($Gridsnap%))
. width%=maxx%-minx%:height%=maxy%-miny%
( fieldtype%=chartype%(Fieldnumber%)
L%=4
fieldtype%
-
40:$Fptr%="file_ff9":valptr%=1:L%=8
:
59:valptr%=SHlogoptr%::$Fptr%=Tag$(Fieldnumber%)
64,65,66,67:
4 deficit%=(height%-6)
44:extra%=44-deficit%
1
deficit%>0
height%+=extra%:y%-=extra%
# valptr%=hvalid%(fieldtype%)
%
:valptr%=hvalid%(fieldtype%)
b field%(Fieldnumber%)=
icon_design(Fieldnumber%,fieldtype%,x%,y%,width%,height%,valptr%,L%,
@$boxX%=
(x%):$boxY%=
(y%):$boxW%=
(width%):$boxH%=
(height%)
!block%=mainW%
"Wimp_GetWindowState",,block%
"Wimp_ForceRedraw",-1,block%!4,block%!8,block%!12,block%!16
swap_fields(F1%,F2%)
F2%>0
F2%<=fields%
desc%(F1%),desc%(F2%)
Tag$(F1%),Tag$(F2%)
field%(F1%),field%(F2%)
len%(F1%),len%(F2%)
chartype%(F1%),chartype%(F2%)
fix%(F1%),fix%(F2%)
calc$(F1%),calc$(F2%)
re_sequence(F1%,F2%,Z%)
jD%=desc%(F1%):T$=Tag$(F1%):F%=field%(F1%):L%=len%(F1%):C%=chartype%(F1%):f%=fix%(F1%):Calc$=calc$(F1%)
I%=F1%+Z%
F2%
desc%(I%-Z%)=desc%(I%):Tag$(I%-Z%)=Tag$(I%):field%(I%-Z%)=field%(I%):len%(I%-Z%)=len%(I%):chartype%(I%-Z%)=chartype%(I%):fix%(I%-Z%)=fix%(I%):calc$(I%-Z%)=calc$(I%)
jdesc%(F2%)=D%:Tag$(F2%)=T$:field%(F2%)=F%:len%(F2%)=L%:chartype%(F2%)=C%:fix%(F2%)=f%:calc$(F2%)=Calc$
icon_design(field%,char%,x%,y%,w%,h%,val%,len%,new%)
flags%,bit%,V%
design%
bit%=&8000
bit%=&1000
char%
9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30:
F !block%=keypadW%:block%!4=char%-9:
"Wimp_GetIconState",,block%
2 w%=block%!16-block%!8:h%=block%!20-block%!12
flags%=&1E00253F
bit%
Keypad buttons. Get w% & h% direct from keypad
char%
13,14:
design%
flags%=&1E00253F
0,1,2,3,4,5,6,7,8,46,47,48,49,50,51,52,53,54,55,56,57,58,63,68,69,70,71,72,73,74,75,76,77,78,79:
E
hide%?field%=1:flags%=&00A535+(winback%<<24)+(winback%<<28)
;
mandatory%?field%=1:flags%=&00A535+(fcol%(9)<<24)
:flags%=&0700A535
21:$Fptr%="Rotate":len%=7:flags%=&1700253D
bit%
27:flags%=&1700253D
bit%
Tools%=1
$Fptr%="List values":len%=12
$Fptr%="Table":len%=6
2 "
28:flags%=&1700253D
bit%
Tools%=1
$Fptr%="Force update":len%=13
$Fptr%="Update":len%=7
31:w%=48:h%=48:flags%=&1700253B
bit%
32:$Fptr%="Print":len%=6:w%=112:h%=48:flags%=&1700253D
bit%
33:w%=44:h%=44:flags%=&1700253B
bit%
34:$Fptr%="Exit":len%=5:w%=112:h%=48:flags%=&1700253D
bit%
35,44:w%=Buttonwidth%*2:h%=84-WithLeaf%*30:flags%=(&1700213F+WithLeaf%*16)
bit%
36,37,38:w%=48:h%=48:flags%=&1700253F
bit%
39:flags%=&0700A535
40:$Fptr%="file_ff9":val%=1:flags%=&0700A53E:len%=8:
present%=7
Rf%(field%)=
create_anchor("Picture"+
(field%))
41,42,43,61,62:w%=52:h%=52:flags%=&1700253B
bit%
45:$Fptr%="Quit":len%=5:w%=112:h%=48:flags%=&1700253D
bit%
59:flags%=&0000A139-logosloaded%+(winback%<<28)
60::w%=84:h%=84:flags%=&1700213F
bit%
64,65,66,67:flags%=&1700A024
w%=0
h%=0
flags%=0
new%
SHformptr%=
claim_page(formanchor%,Fptr%-SHformptr%+len%+4)
Hicon%=
create_icon(0,mainW%,x%,y%,w%,h%,flags%,"",Fptr%,val%,len%+1)
new%
Fptr%+=len%+4
=icon%
get_field(ic%)
F%+=1
field%(F%)=ic%
desc%(F%)=ic%
F%>fields%
adjust_on(on%)
design%=on%:adjust%=on%
lit(designM%,7,on%)
lit(designM%,2,
on%)
lit(designM%,3,
on%)
lit(designM%,4,
on%)
lit(designM%,5,
on%)
shade(createW%,6,
on%)
on%
kill_scrollers(
close_window(keypadW%)
20( w%=ScreenWidth%*2:h%=MaxFields%*64
214 !block%=0:block%!4=-h%:block%!8=w%:block%!12=0
22'
"Wimp_SetExtent",mainW%,block%
F%=1
fields%
25
vtype$(chartype%(F%))
"K","O","T","X":
271
icon_bit(15,mainW%,field%(F%),
adjust%)
28/
icon_bit(12,mainW%,field%(F%),adjust%)
close_window(markW%):markpane%=
:ShowTools%=
change_length(NL%,msg%)
EX%,klm%,S$,N%
EX%=NL%-RA%
EX%=0
2B-SHmarkptr%=
claim_page(markanchor%,NL%+4)
2C*dbasehandle%=
($database%+".Database")
readsmarray(dbasehandle%,RA%)
msg%:
extend_dbase
(EX%>0):
confirm(
msg("Err204,"+
(RA%)+","+
(NL%)))=
extend_dbase
(EX%<0):
confirm(
msg("Err205,"+
(RA%)+","+
(NL%)))=
shorten_dbase
$Records%=
(RA%):N%=RA%
writesmarray(dbasehandle%,N%)
close_file(dbasehandle%)
msg%
addr=
moveto(key%,top,1)
renew_tables
extend_dbase
end%,P%,I%,key%,keybase%,KLM%,S$
key%=0
Keys%
S$=
KL%(key%),".")
KLM%=KL%(key%)+13
P%=LH%+48+(NL%+1)*KLM%
2YF SHkeyptr%(key%)=
extend_named_sliding_block(keyanchor%(key%),P%)
keybase%=SHkeyptr%(key%)
P%=LH%+48+RA%*KLM%
I%=RA%
EX%+RA%-1
!(keybase%+P%)=P%+KLM%
!(keybase%+P%+4)=0
$(keybase%+P%+8)=S$
2`% !(keybase%+P%+KL%(key%)+9)=I%
P%+=KLM%
!(keybase%+P%)=0
!(keybase%+P%+4)=0
$(keybase%+P%+8)=S$
2f" !(keybase%+P%+KL%(key%)+9)=0
key%
end%=(RA%+1)*Length%
"Hourglass_On"
I%=0
EX%-1
2k$
#dbasehandle%=end%+I%*Length%
J%=1
fields%
#dbasehandle%,""
2o.
"Hourglass_Percentage",(I%*100)
"Hourglass_Off"
RA%=NL%
#dbasehandle%=(RA%+1)*Length%
shorten_dbase
P%,L%,R%,s$,key%,keybase%,S$
key%=0
Keys%
S$=
KL%(key%),".")
KLM%=KL%(key%)+13
keybase%=SHkeyptr%(key%)
2|$ s$=$(keybase%+LH%+56+NL%*KLM%)
2}]
s$<>S$
close_file(dbasehandle%):
"Wimp_CreateMenu",,-1:
moan_err%,
msg("Err52")
P%=LH%+48+NL%*KLM%
!(keybase%+P%)=0
!(keybase%+P%+4)=0
$(keybase%+P%+8)=S$
" !(keybase%+P%+KL%(key%)+9)=0
key%
RA%=NL%
#dbasehandle%=(RA%+1)*Length%
copy_database_spritefile(path$,leaf$)
SHappsprite%
BSHappsprite%=
extend_named_sliding_block(sprsanchor%,SHclaim%)
### This is a temporary sprite area used simply to hold ###
### the sprite 'new_appl' whilst it is renamed and saved ###
!SHappsprite%=2600
SHappsprite%!8=16
### Initialise sprite area ###
"OS_SpriteOp",&109,SHappsprite%
### Load !Sprites file from Resources ###
"OS_SpriteOp",&10A,SHappsprite%,"<PBase$Dir>.Resources.Temp.!Sprites"
### Rename sprite 'new_appl' to new database name ###
"OS_SpriteOp",&11A,SHappsprite%,"new_appl",leaf$
### Save spritefile (with renamed new_appl) as !Sprites ###
"OS_SpriteOp",&10C,SHappsprite%,path$+".!Sprites"
### Do same for hi-res sprite ###
"OS_SpriteOp",&109,SHappsprite%
"OS_SpriteOp",&10A,SHappsprite%,"<PBase$Dir>.Resources.Temp.!Sprites22"
"OS_SpriteOp",&11A,SHappsprite%,"new_appl",leaf$
"OS_SpriteOp",&10C,SHappsprite%,path$+".!Sprites22"
scrap_block(sprsanchor%)
rename_database(name$)
SHappsprite%,len%
name$=
force_pling(name$)
"OS_File",5,$database%+".!Sprites22"
,,,,len%
BSHappsprite%=
extend_named_sliding_block(sprsanchor%,len%+100)
!SHappsprite%=len%+100
SHappsprite%!8=16
"OS_SpriteOp",&109,SHappsprite%
"OS_SpriteOp",&10A,SHappsprite%,$database%+".!Sprites"
"OS_SpriteOp",&11A,SHappsprite%,"!"+$dbase%,name$
"OS_SpriteOp",&10C,SHappsprite%,$database%+".!Sprites"
"OS_SpriteOp",&109,SHappsprite%
"OS_SpriteOp",&10A,SHappsprite%,$database%+".!Sprites22"
"OS_SpriteOp",&11A,SHappsprite%,"!"+$dbase%,name$
"OS_SpriteOp",&10C,SHappsprite%,$database%+".!Sprites22"
iconbar_icon(
name$,2))
scrap_block(sprsanchor%)
#$Title%=name$:
redraw(keypadW%)
old$=
leaf($database%)
!name$=leafnamepath$+"."+name$
"OS_CLI","Rename "+$database%+" "+name$
$database%=name$
logging%
"OS_CLI","Unset Log$Dir":
read_sys_vars($database%)
write_log(-1,"Database renamed:",old$+"---> "+
leaf(name$))
defaults(f$,N%,key%)
?abort%=
confirm(
msg("Err133,"+
(N%)+","+Tag$(KF%(0,0))))
abort%
$Records%=
make_empty_index(N%,key%,
save_recs(f$+".Database",N%)
%present%=7:
save_keys:
save_calcs
2design%=
:present%=1:
get_it_in(f$):ramwarn%=
lit(iconbarM%,2,
default_key
first_writable
chartype%(F%)
3,6,46,47,54,56,57,74,75,77,78,79:KL%(0)=len%(F%)
len%(F%)>3
KL%(0)=4
KL%(0)=len%(F%)
key%=0
KW%()=0:KF%()=0
0KW%(0,0)=KL%(0)+(1<<16)+(F%<<24):KF%(0,0)=F%
set_keydata(key%)
new_tree(f%)
REC%,ptr%,file%,old$,new$
old$=
key_structure
selected(keyW%,33):s%=
selected(keyW%,32)
f%=0
M$="Build index with "
M$+="records in same subfiles"
M$+="all records in subfile "+
M$+=" of current database"
M$+=", also restoring 'deleted' records."
M$+=" WARNING! Other indexes will need rebuilding!"
confirm(M$)=
=SHmisc%=
extend_named_sliding_block(tempanchor%,SHclaim%)
mark_files(SHmisc%,0,RA%,
d%,s%,f%)
copy_keydata(0)
"OS_File",5,$database%+".Database"
,,,,len%
RA%=(len%
Length%)-1
scrap_block(keyanchor%(0))
make_empty_index(RA%,0,
close_window(keyW%)
redraw(keypadW%)
%SHmisc%=!tempanchor%:ptr%=SHmisc%
duplicates%=0
"Hourglass_On"
*dbasehandle%=
($database%+".Database")
REC%=0
RA%-1
file%=ptr%?REC%
file%<>255
top=8*file%+LH%
'
readsmarray(dbasehandle%,REC%)
KEY$=
key2(0,1)
K$=
stripright(KEY$," ")
K$<>""
insert(KEY$,0,
%
close_file(dbasehandle%)
5
load_index($database%+".PrimaryKey",0,
&
moan_err%,
msg("Err111")
ptr%?REC%=255
"Hourglass_Percentage",(REC%*100)
REC%
close_file(dbasehandle%)
Vkeybase%=SHkeyptr%(0):nextfree%=!keybase%:nodesize%=12+KL%(0)+1:offset%=8+KL%(0)+1
REC%=0
RA%-1
ptr%?REC%=255
* !(keybase%+nextfree%+offset%)=REC%
nextfree%+=nodesize%
REC%
"newtree%=
:design%=
:adjust%=
"Hourglass_Off"
duplicates%>0
softerror(
(duplicates%),175)
present%=7
new$=
key_structure
refresh_pointers
write_log(-1,"Primary key structure altered. Was: "+old$,"Changed to: "+new$)
"Wimp_CreateMenu",,-1
3file%=0:top=8*file%+LH%:
asterisk(
):ramwarn%=
renew_tables
get_it_in($database%):ramwarn%=
key_structure
I%,W%,chars%,pos%,word%,c$,p$,w$,struc$
I%=0
W%=KW%(0,I%)
W%>0
$ chars%=W%
255:c$=
(chars%)
M pos%=(W%>>8)
255:p$=
(pos%):
pos%=0
p$="L"
pos%=255
p$="R"
( word%=(W%>>16)
255:w$=
(word%)
: struc$+=Tag$(KF%(0,I%))+" ("+w$+","+p$+","+c$+"),"
struc$)
reformat(f$)
I%,J%,F,REC%,dfields%,DLength%,newhandle%,z%,key%,then%,now%,path$,F$,C%,col%,col2%
DTag$(),F%(),F1%(),L%(),V%(),l$(),c$()
f$ will become reformatted database
Original database is open during this function
F$(0)=""
"OS_File",5,f$+".Form"
z%<>1
softerror("",19):=
store_menu_inf
copy_files($database%,f$)
(f$+".Form")
#F,dfields%
DTag$(dfields%),F%(dfields%),F1%(fields%),L%(dfields%),V%(dfields%),l$(dfields%),c$(dfields%)
I%=1
dfields%
3-E
#F,Desc$,DTag$(I%),xd%,yd%,xf%,yf%,L%(I%),V%(I%),extra%,extra%
3.+
V%(I%)=33
DTag$(I%)="!"+DTag$(I%)
3/%
L%(I%)>0
DLength%+=L%(I%)+1
close_file(F)
compare
selected(reformW%,11)
position_window(informW%,0,0,0,0,0,0)
complete(2)
35 newhandle%=
(f$+".Database")
36,dbasehandle%=
($database%+".Database")
"Hourglass_On"
REC%=0
39
#newhandle%=REC%*DLength%
3:%
readsmarray(dbasehandle%,REC%)
I%=1
dfields%
S$=F$(F%(I%))
V%(I%)
5,50,51,70,71:
3@2
S$="":
Date field blank; do nothing
3A2
(S$)=10
L%(I%)=8:S$=
S$,6)+
S$,2)
3B"
(S$)=8
L%(I%)=10:
y$=
S$,2):y%=
3D6
y%<CentChange%
y$="20"+y$
y$="19"+y$
S$=
S$,6)+y$
64,65,66,67:
3H9
V%() holds destination database's field-types
3I2
chartype%() holds original field-types
3J6 Scols%=chartype%(F%(I%))-63:Dcols%=V%(I%)-63
Scols%<>Dcols%
3L5 L%=
blob_path(
,f$,REC%,F%(I%),V%(I%),b$)
L%>0
3N0 old%=
(b$):temp%=
("<Wimp$Scrap>")
#old%
3P# F$=
#old%:col%=C%+1
3R,
col%>Dcols%:
Do nothing
3S5
col%=Scols%:
#temp%,F$:col2%=col%
3T!
col2%<Dcols%
3U'
#temp%,"":col2%+=1
3W+
col%<=Dcols%:
#temp%,F$
3Y" C%=(C%+1)
Scols%
3[2
close_file(old%):
close_file(temp%)
3\:
"OS_CLI","Copy <Wimp$Scrap> "+b$+" ~C~VF"
3_
3`'
(S$)>L%(I%)
S$,L%(I%))
3a$
L%(I%)>0
#newhandle%,S$
3c0
"Hourglass_Percentage",(REC%*100)
REC%
"OS_CLI","Remove <Wimp$Scrap>"
"Hourglass_Off"
close_file(newhandle%)
close_file(dbasehandle%)
"OS_File",18,f$+".Database",&fff
link$(0)="LOADED"
(f$+".Link")
F%=1
dfields%
#F,l$(F%)
close_file(F)
calc$(0)="LOADED"
(f$+".Calc")
F%=1
dfields%
#F,c$(F%)
close_file(F)
key%=0
Keys%
3yK
key%=0
path$=f$+".PrimaryKey"
path$=f$+".Indexes."+Index$(key%)
(path$)
#F=74
J%=0
then%=KW%(key%,J%)>>24
3~,
then%>0
now%=F1%(then%)
now%=0
#F=74+3+J%*4
now%<>then%
#F,now%
close_file(F)
key%
close_window(reformW%)
close_it(informW%)
asterisk(
write_log(-1,"Record structure changed","")
compare
source%,dest%,del$,short$,col$
source%=1
fields%
chartype%(source%)=33
Tag$(source%)="!"+Tag$(source%)
dest%=dfields%+1
dest%-=1
dest%=0
DTag$(dest%)=Tag$(source%)
* F%(dest%)=source%:F1%(source%)=dest%
dest%=0
del$+=Tag$(source%)+"\"
l$(dest%)=link$(source%)
c$(dest%)=calc$(source%)
chartype%(source%)
64,65,66,67:
B
V%(dest%)<chartype%(source%)
col$+=Tag$(source%)+"\"
A
L%(dest%)<len%(source%)
short$+=Tag$(source%)+"\"
source%
del$<>""
confirm(
msg("Err97,"+
del$)))
short$<>""
confirm(
msg("Err117,"+
short$)))
col$<>""
confirm(
msg("Err177,"+
col$)))
merge_files(merge$,new$,fi%)
R%,REC%,ptr%,file%,d%,s%,z%,RUM%,RAM%,NL%,ex%,blobs%
new$<>$database%
"OS_CLI","Copy "+$database%+" "+new$+" ~C ~V R"
get_it_in(new$)
text(mergebaseW%,2)=$database%:
redraw_icon(mergebaseW%,2)
"OS_File",5,merge$+".Database"
z%<>1:
softerror("",29)
merge$=$database%:
softerror("",15)
identical(merge$):
softerror("",21)
? s%=
selected(mergebaseW%,11):d%=
selected(mergebaseW%,12)
fi%=0
! M$="Merge "+merge$+" with "
M$+="corresponding subfiles"
M$+="subfile "+
(fi%)
M$+=" of current database"
M$+=", also restoring deleted records"
M$+=". WARNING! indexes will need rebuilding!"
confirm(M$)=
4
"OS_File",5,merge$+".Database"
,,,,len%
RAM%=(len%
Length%)-1
I
### Load primary key of file to be merged into a spare slot ###
6
load_index(merge$+".PrimaryKey",MaxKeys%+1,
@
### Mark which subfile each new record is to go in ###
= SHmisc%=
extend_named_sliding_block(tempanchor%,RAM%)
8
mark_files(SHmisc%,MaxKeys%+1,RAM%,
d%,s%,fi%)
& keybase%=SHkeyptr%(MaxKeys%+1)
F
### Count how many record actually used in file to merge ###
-
count(MaxKeys%+1,RUM%):
count(0,RU%)
*
NL%=RU%+RAM%
NL%=RU%+RUM%
"Hourglass_On"
O
### Expand existing file if new length (NL%) exceeds availability ###
)
NL%>RA%
change_length(NL%,
& blobs%=
find_blobs($database%)
) SHmisc%=!tempanchor%:ptr%=SHmisc%
R%=0
RAM%-1
file%=ptr%?R%
file%<>255
make_new_rec
top=8*file%+LH%
(
read(
,fields%,
,R%,merge$)
<
selected(mergebaseW%,10)
dontincrement%=
write(fields%,key%)
ex%=-1
ex%<blobs%
! ex%+=1:F%=Ext%(ex%)
D
copy_blob(merge$,$database%,R%,REC%,F%,chartype%(F%))
5
"Hourglass_Percentage",(R%*100)
RUM%
"Hourglass_Off"
close_it(mergebaseW%)
! file%=fi%:top=8*file%+LH%
addr=
moveto(key%,top,1)
asterisk(
write_log(-1,"Records merged from database:",merge$)
identical(f$)
I%,F,dfields%,different%
(f$+".Form")
#F,dfields%
dfields%<>fields%
different%=
I%<fields%
different%
I%+=1
#F,Desc$,Tag$,xd%,yd%,xf%,yf%,len%,char%,extra%,extra%
char%=char%
char%<>39
len%<>len%(I%)
different%=
char%<>chartype%(I%)
(char%>8
chartype%(I%)>8)
different%=
close_file(F)
different%
mark_files(ptr%,key%,RA%,d%,s%,f%)
P%,I%,M,file%,top
"Hourglass_On"
I%=0
RA%-1
ptr%?I%=d%
file%=0
top=8*file%+LH%
! P%=
neighbour(key%,top,1)
P%<>top
S%=
rec_no(k$,key%,P%)
+
ptr%?S%=file%
ptr%?S%=f%
" P%=
neighbour(key%,P%,1)
file%
"Hourglass_Off"
print_tree(key%,PR$)
L%(),levels%(),COL%,levels%,depth%,P%,keybase%,L%,L$,M$,fi%,top,maxlevels%,total%,sym%,pos%
levels%(5)
4 PTextName$=$database%+".PrintJobs.Tree"+
Index$(key%),6):$SaveName%=TextName$
ticked(indextreeM%,1)
from%=file%:to%=file%
from%=0:to%=5
"Hourglass_On"
fi%=from%
top=8*fi%+LH%
COL%=0:depth%=0
A keybase%=SHkeyptr%(key%):P%=!(keybase%+top):
traverse(P%,
levels%(fi%)=depth%-2
levels%(fi%)>maxlevels%
maxlevels%=levels%(fi%)
maxlevels%>127
rectify_address(key%):
moan_err%,
msg("Err153")
L%(maxlevels%)
interval%=
(2^maxlevels%))
PR$="ALL"
KL%(key%)>interval%
interval%=KL%(key%)
interval%+=1
print_init("W")
format$="tree"
1LenLine%=Lmargin%+(maxlevels%+1)*interval%+12
LenLine%<30
LenLine%=30
%maxhead%=0:hspace%=200:fspace%=18
(Tab%(2)=12:PrintFields%=maxlevels%+2
L%=1
maxlevels%+1
% Tab%(L%+2)=Tab%(L%+1)+interval%
end_line
send_title(
send_title($dbase%+" - Tree Analysis")
send_title("Key "+
(key%)+" ("+Index$(key%)+")")
sym%=
ticked(indextreeM%,2)
fi%=from%
levels%(fi%)>=0
4*' pos%=TextPtr%+Lmargin%+LenLine%
store_rec_num(-2)
4,3
store_string("Subfile "+
(fi%),Lmargin%,
store_rec_num(-2)
end_line
4/#
tree_heading(levels%(fi%))
top=8*fi%+LH%
COL%=0:depth%=0:L%()=0
42C keybase%=SHkeyptr%(key%):P%=!(keybase%+top):
traverse(P%,
total%=
(L%())
S$=
(total%)+" node"
total%>1
S$+="s"
46% $pos%=S$:pos%+=
(S$):?pos%=32
PR$="ALL"
48 L1$=
padL("1",interval%)
store_rec_num(-2)
4:2
store_string("No. nodes "+L1$,Lmargin%,
L%=0
L%<levels%(fi%)
L%+=1
4>( L$=
padL(
(L%(L%)),interval%):
4?6
store_string(L$,Lmargin%+L%*interval%+10,
4@
end_line
store_rec_num(-2)
4C2
store_string("Max.nodes "+L1$,Lmargin%,
L%=0
L%<levels%(fi%)
L%+=1
4G% M$=
padL(
(2^L%),interval%)
4H6
store_string(M$,Lmargin%+L%*interval%+10,
4I
end_line
4K9
PR$="ALL"
tree_heading(levels%(fi%))
"Hourglass_Off"
tkey%=key%
screen_list
write_log(-1,"Tree printed: subfile:"+
(fi%)+", key:"+
(key%)+", "+Index$(key%),"")
tree_heading(levels%)
zero%,L%
store_rec_num(-2)
store_string("Level No.",Lmargin%,
padL("0",interval%)
store_string(L$,Lmargin%+10,
L%<levels%
L%+=1
L$=
padL(
(L%),interval%)
4^2
store_string(L$,Lmargin%+L%*interval%+10,
end_line
4b"count%=
count_recs(key%,zero%)
traverse(P%,Z%)
string$
COL%+=1
COL%>depth%
depth%=COL%
P%<0
read_node(keybase%+P%)
sym%
traverse(L%,Z%):COL%-=1:
read_node(keybase%+P%)
L%(COL%-1)=L%(COL%-1)+1
PR$="ALL"
store_rec_num(rec%)
S$=$(keybase%+P%+8)
S$=
stripright(S$,"#")
S$=
padL(S$,interval%)
4s:
store_string(S$,Lmargin%+(COL%-1)*interval%+10,
sym%
traverse(R%,Z%)
traverse(L%,Z%)
COL%-=1
sym%
read_node(keybase%+P%):
traverse(R%,Z%):COL%=COL%-1
read_node(P%)
4|*L%=!P%:R%=P%!4:rec%=P%!(8+KL%(key%)+1)
balance(key%)
recptr%,top,file%,I%,N%,A%,max%,done%,highest%,avail%,seglen%,REC%,SHbalptr%,SHflag%
recs%(),ptr%()
recs%(5),ptr%(5)
set_keydata(key%)
-newtree%=
seglen%=KL%(key%)+5
ASHrecptr%=
extend_named_sliding_block(recanchor%,seglen%*RA%)
ASHbalptr%=
extend_named_sliding_block(balanchor%,seglen%*RA%)
8SHflag%=
extend_named_sliding_block(flaganchor%,RA%)
recptr%=SHrecptr%
I%=0
RA%-1
SHflag%?I%=255
Bytes are changed from 255 to 0 where records are in use
"Hourglass_On"
file%=0
ptr%(file%)=recptr%
top=8*file%+LH%
. recs%(file%)=
count_recs(key%,recptr%)-1
max%+=recs%(file%)+1
file%
make_empty_index(RA%,key%,
"Hourglass_LEDs",%11
file%=0
top=8*file%+LH%
recs%(file%)>=0
recptr%=ptr%(file%)
N%=1
N%=N%+N%
N%>recs%(file%)+2
step%=N%
N%=(N%
2)-1
start%=N%
C%=0
start%=start%
end%=N%-start%-1
step%=step%
$
I%=start%
end%
step%
9 A%=recptr%+seglen%*(I%*(recs%(file%)+1)
A SHbalptr%!C%=!A%:$(SHbalptr%+C%+4)=$(A%+4):!A%=-!A%-1
C%+=seglen%
step%=2
%
I%=0
C%-seglen%
seglen%
2 REC%=SHbalptr%!I%:KEY$=$(SHbalptr%+I%+4)
insert(KEY$,key%,
done%+=1
6
"Hourglass_Percentage",(done%*100)
max%
I%=0
recs%(file%)
# REC%=recptr%!(seglen%*I%)
REC%>=0
( KEY$=$(recptr%+seglen%*I%+4)
insert(KEY$,key%,
done%+=1
8
"Hourglass_Percentage",(done%*100)
max%
file%
"Hourglass_LEDs",%00
keybase%=SHkeyptr%(key%)
nodesize%=8+KL%(key%)+1+4
avail%=!keybase%
I%=0
highest%
SHflag%?I%=255
+ !(keybase%+avail%+8+KL%(key%)+1)=I%
avail%+=nodesize%
"Hourglass_Off"
save_keys
scrap_block(balanchor%)
scrap_block(flaganchor%)
scrap_block(recanchor%)
newtree%=
asterisk(
write_log(-1,"Index "+Index$(key%)+" balanced","")
duplicates(key%)
P$,S$,RP$,RS$,addr,top,RP%,RS%,count%,examined%,file%,zero%
abort_dup:
print_init("W")
format$="dup"
YTextName$=$database%+".PrintJobs.Dupl"+
Index$(key%),5)+
(file%):$SaveName%=TextName$
"LenLine%=Lmargin%+KL%(key%)+21
LenLine%<Lmargin%+26
LenLine%=Lmargin%+26
spacer$,"|")>0
spacer$="|"
NTab%(2)=14:Tab%(3)=19:maxhead%=0:fspace%=18:hspace%=4*36-18:PrintFields%=3
end_line
send_title("Duplicated keys")
send_title(
"Hourglass_On"
file%=0
send_title($Subfile%(file%))
top=8*file%+LH%
! addr=
neighbour(key%,top,1)
0 count%=
count_recs(key%,zero%):examined%=0
addr<>top
$ S$=$(SHkeyptr%(key%)+addr+8)
S$=
stripright(S$,"#")
/ RS%=!(SHkeyptr%(key%)+addr+9+KL%(key%))
; RS$=
(RS%):RS$="Record No."+
(RS$)," ")+RS$+" "
S$<>P$
P$=S$:RP%=RS%:RP$=RS$
store_rec_num(RP%)
*
store_string(RP$+P$,Lmargin%,
store_rec_num(RS%)
*
store_string(RS$+S$,Lmargin%,
examined%+=1
8
"Hourglass_Percentage",examined%*100
count%
$ addr=
neighbour(key%,addr,1)
file%
"Hourglass_Off"
screen_list
abort_dup
"Hourglass_Off"
screen_list
softerror("",67)
wimp_error(
Index handling ------------------------------------------------------
neighbour(key%,addr%,d%)
R%,S%,p%,keybase%
%SHkeyptr%(key%)=!keyanchor%(key%)
keybase%=SHkeyptr%(key%)
p%=d%*4
R%=!(keybase%+addr%+p%)
R%<0
=-R%
p%=4-p%
addr%=R%
S%=!(keybase%+addr%+p%)
S%>0
R%=S%
S%<=0
rec_no(
k$,key%,addr%)
!k$=$(SHkeyptr%(key%)+addr%+8)
+=!(SHkeyptr%(key%)+addr%+8+KL%(key%)+1)
scan_marked_subfiles(c$,key%,action%,direc%,currentkey%)
file%,top
special%(5)
(libfunc$+"_function(5)")
"Hourglass_On"
file%=0
5"$
selected(queryW%,file%+6)
top=8*file%+LH%
currentkey%
5%( P%=
neighbour(key%,top,direc%)
5&2
scan_file(c$,key%,file%,action%,direc%)
kl%=
(useval$)
5)$ P%=
search(useval$,key%,1)
5*G
P%>=0
k$=useval$:
scan_file(c$,key%,file%,action%,direc%)
5+
file%
"Hourglass_Off"
special%(6)
(libfunc$+"_function(6)")
scan_file(c$,key%,file%,action%,direc%)
REC%,examined%,subtotal%,X%,Y%,n$,copy%,I%,base%,zero%,end$
base%=SHmarkptr%
n$="0123456789."
key%=usekey%
57-
direc%=1
end$="first"
end$="last"
58T subtotal%=
count_matches(end$,"LEFT$($(SHkeyptr%(key%)+P%+8),kl%)=useval$",P%)
5:' subtotal%=
count_recs(key%,zero%)
(c$)=
REC%=
rec_no(k$,key%,P%)
5>%
readsmarray(dbasehandle%,REC%)
examined%+=1
(Search$)=
5A5
special%(7)
(libfunc$+"_function(7)")
action%
5C"
### print/mark ###
matchopt%
5E&
print_record(REC%,P%)
5FF
SHmarkptr%?REC%=0
SHmarkptr%?REC%=1:MarkedRecs%+=1
5GG
SHmarkptr%?REC%=1
SHmarkptr%?REC%=0:MarkedRecs%-=1
printed%+=1
5J/
2:ptr%?REC%=file%:
### earmark ###
5K3
write_csv_rec(REC%,Form$,csvhandle%)
5M
### create index ###
5N7 KEY$=
key2(newkey%,1):
insert(KEY$,newkey%,
5P!
### global change ###
S$=F$(Menufield%)
5SC
New$,$ws%)>0:S$=
wildcard_replace(S$,Old$,New$,$ws%)
5TC
New$,$wc%)>0:S$=
wildcard_replace(S$,Old$,New$,$wc%)
numeric%:
X%=0:Y%=0
X%+=1
5X)
(S$)
S$,X%,1))>0
X%<=
(S$)
Y%=X%
Y%+=1
5\+
(S$)
S$,Y%,1))=0
5^9 S$=
S$,X%-1)+
S$,X%,Y%-X%)+New$))+
S$,Y%)
5_*
Old$<>"":
S$=Old$
S$=New$
:S$=New$
5b)
(S$)>TextLength%
flag%
5c:
softerror(S$+","+Tag$(Menufield%),10):flag%=
"Hourglass_On"
5f) F$(Menufield%)=
S$,TextLength%)
5g*
writesmarray(dbasehandle%,REC%)
5i:
### update time-dependent calcs on opening ###
I%=1
fields%
chartype%(I%)
5l.
21,27,28,32,34,40,45,59,80,81:
5mR
$Rf%(I%) holds key legend or other important data. Don't overwrite
:$Rf%(I%)=F$(I%)
5oI
updatethese%
set_now(chartype%(I%),I%):F$(I%)=$Rf%(I%)
5r6
update$(0)<>""
changed%=
update_calcs(0)
5s*
writesmarray(dbasehandle%,REC%)
5u/
### assign new sequence numbers ###
F$(F%)=sequenceval$
5w+ sequenceval$=
(sequenceval$)+1)
5x*
writesmarray(dbasehandle%,REC%)
5y/ $(SHkeyptr%(key%)+P%+8)=
key2(key%,1)
5z
5|# P%=
neighbour(key%,P%,direc%)
5};
"Hourglass_Percentage",(examined%*100)
subtotal%
multitask%
poll(
wildcard_replace(S$,Old$,New$,type$)
old$,new$,old2$,new2$,c$,L%,P%,R%
type$
$ws%:
D
Old$,1)=$ws%
New$,1)=$ws%
Old$)=$ws%
New$)=$ws%:
' old$=
Old$,2)):new$=
New$,2))
P%=
S$,old$)
2
P%>0
S$,P%-1)+new$+
S$,P%+
(old$))
(
Old$,1)=$ws%
New$,1)=$ws%:
/ old$=
Old$,2):new$=
New$,2)::R%=
(old$)
.
S$,R%)=old$
(S$)-R%)+new$
$
Old$)=$ws%
New$)=$ws%:
* old$=
Old$):new$=
New$):L%=
(old$)
*
S$,L%)=old$
S$=new$+
S$,L%+1)
(
Old$,$ws%)>0
New$,$ws%)>0:
P P%=
Old$,$ws%):old$=
Old$,P%-1):L%=
(old$):old2$=
Old$,P%+1):R%=
(old2$)
9 P%=
New$,$ws%):new$=
New$,P%-1):new2$=
New$,P%+1)
*
S$,L%)=old$
S$=new$+
S$,L%+1)
0
S$,R%)=old2$
(S$)-R%)+new2$
$wc%:
(Old$)=
(New$)
P%=1
(Old$)
c$=
Old$,P%,1)
;
c$<>$wc%
S$,P%,1)
S$,P%,1)=
New$,P%,1)
search(S$,key%,M%)
P%,found%,info$,keybase%,rec%,cond$
keybase%=SHkeyptr%(key%)
Z%=0:P%=top:ident%=
L%=P%
P%=!(keybase%+L%+Z%)
P%>0
info$=$(keybase%+P%+8)
rec%=
rec_no(k$,key%,P%)
P%=-L%:found%=
(val$+"(S$)="+val$+"LEFT$(info$,kl%)")
0:ident%=(key%=0)
1:found%=
$
rec%=REC%
found%=
found%
Z%=-
(val$+"(S$)>="+val$+"(info$)")*4
found%
/=P%
### M%=0 - Find leaf position at which to insert ###
### M%=1 - Find first match in tree (if there is one) ###
### M%=2 - Find exact matching record, checking for record no. ###
insert(
S$,key%,dupwarn%)
P%,avail%,kl%,keybase%,abort%
Index$(key%)=""
Index deleted
S$=""
null%(key%)=
keybase%=SHkeyptr%(key%)
"kl%=KL%(key%):val$=
type(key%)
search(S$,key%,0)
ident%
!
selected(passW%,15):
"
softerror(S$,37):abort%=
dupwarn%
4
confirm(
msg("Err45,"+S$))
abort%=
duplicates%+=1
abort%
S$="*Failed*":
nextfree%=!keybase%
!(keybase%+nextfree%)<=0
incr%=
($Increment%)
incr%>0
#
change_length(RA%+incr%,
S$="*Failed*"
S$="*Failed*"
softerror("",2):
avail%=!(keybase%+nextfree%)
.!(keybase%+nextfree%+Z%)=!(keybase%+P%+Z%)
$!(keybase%+nextfree%+(4-Z%))=-P%
$(keybase%+nextfree%+8)=S$
,!(keybase%+nextfree%+8+KL%(key%)+1)=REC%
!(keybase%+P%+Z%)=nextfree%
!keybase%=avail%
key%=0
RU%+=1
delete(
S$,key%)
P%,A%,kl%,keybase%
Index$(key%)=""
Index deleted
S$=""
null%(key%)=
keybase%=SHkeyptr%(key%)
A%=!keybase%
"kl%=KL%(key%):val$=
type(key%)
search(S$,key%,2)
P%<0
softerror(S$+","+Index$(key%),1):S$="*Failed*":
neighbour(key%,P%,0)
neighbour(key%,P%,1)
'!(keybase%+L%+Z%)=!(keybase%+P%+Z%)
Q%=P%
ZL%=4-Z%
P1%=!(keybase%+P%+ZL%)
P1%>0
info$=$(keybase%+P1%+8)
P%=-
search(info$,key%,0)
!(keybase%+P%+Z%)=P1%
!(keybase%+PR%+4)<=0
!(keybase%+PR%+4)=-SU%
!(keybase%+SU%+0)<=0
!(keybase%+SU%+0)=-PR%
!(keybase%+Q%)=A%
!keybase%=Q%
key%=0
RU%-=1
save_keys
keyN%
present%<>7
"Hourglass_On"
refresh_dates
3keybase%=SHkeyptr%(0):keybase%!4=
($Increment%)
SHkeyptr%(keyN%)>0
keybase%=SHkeyptr%(keyN%)
8 filelength%=
sliding_block_size(keyanchor%(keyN%))
keyN%=0
index$=""
index$="indexes."
Index$(keyN%)<>""
"OS_File",10,$database%+"."+index$+Index$(keyN%),&7F0,,keybase%,keybase%+filelength%
keyN%+=1
"Hourglass_Percentage",keyN%*100
(Keys%+1)
"Hourglass_Off"
readsmarray(filehandle%,REC%)
loop%
"OS_Byte",229,1:
"OS_Byte",124
#filehandle%=REC%*Length%
F$()=""
loop%=1
fields%
zerolen%?loop%=0
F$(loop%)=
#filehandle%
loop%
"OS_Byte",229,0
special%(2)
(libfunc$+"_function(2)")
writesmarray(F,
loop%,F$,L%
#F=R%*Length%
loop%=1
fields%
6!! F$=F$(loop%):L%=len%(loop%)
zerolen%?loop%=0
6#+
(F$)<=L%
#F,F$
L%,"!")
loop%
6& R%+=1
special%(4)
(libfunc$+"_function(4)")
check_save(T%)
T%=0
SaveCount%+=1
SaveCount%*ReturnEvery%<T%*6000
buttonfield%(0,19)>0
wi%=mainW%:ic%=field%(buttonfield%(0,19))
wi%=keypadW%:ic%=19
autosave%
delay%=
loop%=0
invert(wi%,ic%)
delay%+=50
>delay%
1,-10,100,10
invert(wi%,ic%)
delay%+=50
>delay%
loop%
undo%=2
6=$
confirm(
msg("Err166"))
invert(wi%,ic%)
mouse(0,0,4,wi%,ic%)
invert(wi%,ic%)
undo%=0
6B
6C
SaveCount%=0
Calculations ---------------------------------------------------------
calc_link(T$,type%)
### Sets up calculation formula window & menu entry ###
$CalcFunc%=T$
I%=1
T$=
$CalcTitle%=T$
split_link(Fieldnumber%,real$,visible$)
type%
6,7:
6T0 $CalcForm%=Tag$(Fieldnumber%)+"="+visible$
6U+
shade(calcW%,2,
shade(calcW%,4,
$CalcForm%=visible$
6X+
shade(calcW%,2,
shade(calcW%,4,
deselect(calcW%,2)
redraw_icon(calcW%,0)
OldField%=Fieldnumber%
set_up_calc(wi%,calc%)
Ecalc%=10
moan_err%,
msg("Err211")
text(wi%,0)=ephemera$(calc%,0):
redraw_icon(wi%,0)
text(wi%,1)=ephemera$(calc%,2):
redraw_icon(wi%,1)
text(wi%,11)=
(calc%):
redraw_icon(wi%,11)
deselect(wi%,
selected_esg(wi%,1))
calc%=Ecalc%
text(wi%,14)="15"
text(wi%,6)="Include"
select(wi%,2)
6j' $
text(wi%,14)=ephemera$(calc%,3)
text(wi%,6)="Modify"
6l,
select(wi%,
(ephemera$(calc%,4))-252)
redraw_icon(wi%,14)
redraw_icon(wi%,6)
set_caret(0,wi%,0)
extra_calcs(wi%,ic%,b%)
z%,I%,V%,F%,vis$,real$,F$,sp$
b%=b%
(%111)
b%=4
z%=1
z%=-1
ic%
6x.
15,16:
ic%=15
calc%+=z%
calc%-=z%
calc%>Ecalc%
calc%=0
calc%<0
calc%=Ecalc%
set_up_calc(wi%,calc%)
2,3:
6}E
selected(wi%,2)
text(wi%,14)="15"
text(wi%,14)="255"
redraw_icon(wi%,14)
b%=2
b%=4
& fieldsM%=
field_menu(items%,1)
+
show_pop_up_menu(fieldsM%,wi%,ic%)
fieldfunc$="calc"
close_window(wi%):
restore_caret(returnto%)
clear_selection:
set_up_calc(wi%,Ecalc%)
F%=MaxFields%+3+calc%
selected(wi%,2)
V%=254
V%=255
len%(F%)=
text(wi%,14))
vis$=$
text(wi%,0)
vis$=""
moan_err%,
msg("Err212")
$ real$=
real_calc(vis$,V%,"F$")
V%=254
real$="STR$("+real$+")"
chartype%(F%)=V%
: Tag$(F%)=$
text(wi%,1):
Tag$(F%)=""
Tag$(F%)=vis$
calc_error(F$,F%,vis$,real$):
1 F$()="107":
Avoid 'division by zero' error
: F$=
(real$):
Test to see if formula contains errors
F$()=""
6 ephemera$(calc%,0)=vis$:ephemera$(calc%,1)=real$
@ ephemera$(calc%,2)=Tag$(F%):ephemera$(calc%,3)=
(len%(F%))
ephemera$(calc%,4)=
calc%=Ecalc%
3
(-1)
F$="Y"+
(calc%)
F$="X"+
(calc%)
B
Determines whether output is concatenated (Y) or not (X)
printorder$+=F$
Ecalc%+=1
0
1:calc%=Ecalc%:
set_up_calc(wi%,calc%)
=
close_window(wi%):
set_caret(0,mainW%,returnto%)
shade(matchW%,7,printorder$<>"")
I%=7
lit(printM%,I%,printorder$<>"")
calc_formula(F%,wi%,ic%,b%,S$)
### Parses calculation formula (S$) & builds calc$(F%) ###
C$,F$,N%
b%=b%
(%111)
S$=""
calc$(F%)=""
ic%
close_window(wi%):
restore_caret(returnto%)
b%=2
b%=4
& fieldsM%=
field_menu(items%,1)
+
show_pop_up_menu(fieldsM%,wi%,ic%)
fieldfunc$="calc"
# C$=
~(F%):
F%<16
C$="0"+C$
$CalcFunc%="Set base value..."
split_link(F%,R$,V$)
(S$)>=
(R$)
S$=""
S$="0"
calc$(F%)=S$+"|"+S$
calc$(0)="LOADED"
display(key%,-1)
softerror(R$,209)
& P%=
S$,"="):visible$=
S$,P%+1)
4 S$=
real_calc(visible$,chartype%(F%),"$Rf%")
2
calc_error(F$,F%,visible$,S$):
S$<>""
1
chartype%(F%)=6
(S$)
#
(S$)+
(visible$)+2<256
' calc$(F%)="#"+S$+"#"+visible$
calc$(0)="LOADED"
/
selected(wi%,2)
recalculate(F%)
softerror("",44)
F%=0:
deselect(wi%,2)
asterisk(
b%=4
close_window(wi%)
real_calc(S$,V%,ar$)
I%,P%,L%,t$,s$,f$,ok$,cl$,cr$,time%,date%,user%,ok%
ar$+="("
ok$="(),.+-*/=<> "
I%=fields%
vtype$(chartype%(I%))<>"O"
! t$=Tag$(I%):L%=
(t$):P%=0
t$<>""
f$=ar$+
(I%)+")"
% user%=(
S$,"FNU",P%+1)>0)
) P%=
S$,t$,P%+1):cl$="":cr$=""
P%>0
. cl$=
S$,P%-1,1):cr$=
S$,P%+L%,1)
C
Check that located tag isn't substring of another
S$=t$:ok%=
0
S$,L%)=t$
ok$,cr$)>0:ok%=
0
S$,L%)=t$
ok$,cl$)>0:ok%=
1
ok$,cl$)>0
ok$,cr$)>0:ok%=
:ok%=
)
ok%
chartype%(I%)<>33
s$=f$
"
chartype%(I%)
6
3,6,46,47,54,56,57,74,75,77,78,79:
A
user%
s$="VAL("+f$+")":
Treat as numbers
I
5,50,51,70,71:
user%
s$="FNdays("+f$+")":date%=
F
8,48,68:
user%
s$="FNseconds("+f$+")":time%=
v
user%
s$="FNn("+
(I%)+")":
If not in user func. assume no. from next col. of val. table
* S$=
S$,P%-1)+s$+
S$,P%+L%)
/
ar$="$Rf%("
update$(I%)+=C$
P%=0
S$,"TIME$")>0
ar$="$Rf%("
update$(0)+=C$
time%=
V%=7
S$="FNtime("+S$+")"
date%=
V%=7
S$="FNdate("+S$+","+
(len%(F%))+")"
recalculate(F%)
F,I%,R%,k$,P%,real$,visible$,subtotal%,zero%,examined%
calc_error(F$,F%,visible$,real$):
split_link(F%,real$,visible$)
'visible$=
replace(visible$,",","\")
confirm(
msg("Err206,"+Tag$(F%)+","+visible$))=
%subtotal%=
count_recs(key%,zero%)
"Hourglass_On"
*dbasehandle%=
($database%+".Database")
neighbour(key%,top,1)
P%<>top
R%=
rec_no(k$,key%,P%)
readsmarray(dbasehandle%,R%)
I%=1
fields%
-
chartype%(I%)<>40
$Rf%(I%)=F$(I%)
chartype%(F%)
F=
(real$):F$=
+
fix%(F%)>0
fix_point(F$,F%)
7:F$=
(real$)
(F$)<=len%(F%)
F$(F%)=F$
7 $
writesmarray(dbasehandle%,R%)
P%=
neighbour(key%,P%,1)
examined%+=1
7#9
"Hourglass_Percentage",examined%*100
subtotal%
"Hourglass_Off"
close_file(dbasehandle%)
I%=1
fields%
chartype%(I%)
7)"
21,27,28,32,34,40,45,59:
7*M
$Rf%(I%) holds key legend or other important data. Don't overwrite!
:$Rf%(I%)=field$(I%)
7,
display(key%,addr)
asterisk(
save_calcs
calc$(0)="LOADED"
($database%+".Calc")
F%=1
fields%
#F,calc$(F%)
close_file(F)
sums(
F$,F%,type%)
F$<>""
type%
8:V=
seconds(F$)
Sum(F%,0)+=1
Sum(F%,1)+=V
Sum(F%,3)+=V*V
7H!
V>Sum(F%,4)
Sum(F%,4)=V
7I!
V<Sum(F%,5)
Sum(F%,5)=V
ctotals(flag%)
F%,I%,J%,N%,R%,S%,pos%,F$,last%,sp$,N
last%=
(Form$)-1
I%=1
last%
F%=
fnum(
Form$,I%,2))
R%=calcrow%?F%
chartype%(F%)
7T.
3,6,8,46,47,54,56,57,74,75,77,78,79:
Sum(R%,0)>0
7V' Sum(R%,2)=Sum(R%,1)/Sum(R%,0)
7W+ N=Sum(R%,3)/Sum(R%,0)-Sum(R%,2)^2
7X.
N>0
Sum(R%,3)=
Sum(R%,3)=0
7Y
7Z'
Sum(R%,5)=10^30
Sum(R%,5)=0
J%=0
7^F
flag%=TRUE means that first field in list is involved in calcs
flag%
7`< N%=0:start%=1:F$=
justify(S$(J%),1,0," ")+" ":pos%=0
7a/
N%=1:start%=3:F$=S$(J%):pos%=Lmargin%
store_string(F$,pos%,
(Form$)>2
start%=1
I%=start%
last%
7f+
I%<last%
sp$=spacer$
sp$=""
7g& F%=
fnum(
Form$,I%,2)):F$=""
N%+=1
chartype%(F%)
7j2
3,6,8,46,47,54,56,57,74,75,77,78,79:
R%=calcrow%?F%
7lQ
chartype%(F%)=8
result$=
time(Sum(R%,J%))
result$=
(Sum(R%,J%))
7mZ
selected(numscrollW%,R%*8-6+J%)
justify(result$,N%+1,N%,sp$):f%(J%)=1
7o&
store_string(F$,Tab%(N%),
f%(J%)=1
store_rec_num(-1)
end_line
7t
(f%())>0
format$="horiz"
$TextPtr%=
8," "):
margin_check
f%,F%,R%,J%
fnum(
Form$,2))
chartype%(F%)
7~*
3,6,46,47,54,56,57,74,75,77,78,79:
R%=calcrow%?F%
J%=0
2
selected(numscrollW%,R%*8-6+J%)
f%=F%
f%>0
Lmargin%=8:Tab%(0)=0:Tab%(1)=Lmargin%:=
justify(f$,x%,x1%,s$)
L%=Tab%(x%)-Tab%(x1%)-
(f$)>L%
f$=
f$,L%)
(f$)," ")+f$
f$)="."
f$=" "+
execute_file(F%)
S$,file$,d%,F
link$(F%),1)="@"
file$=
link$(F%),2)
* file$=
filename(file$,"PrintRes",-1)
"OS_File",5,file$
d%,,type%
type%=(type%>>8)
&fff
type%=&fff
(file$):S$=
close_file(F)
;
S$,7)="!SCRIPT"
(-1):
execute_script(file$)
(
"OS_CLI","Filer_Run "+file$
execute_script(f$)
F,P%,F%,F$,junk$,line$,name$,params$,command$,file$,from$,to$,oscli$,space%,finished%,firstquery%,state%,X%,spr$,z%,input%,cancel%,f%
selected(printW%,23)
reportdest$="File"
reportdest$="Window"
abort_script:
finished%
cancel%)
line$=
space%=
line$," ")
space%=0
command$=line$:params$=""
command$=
line$,space%-1):params$=
line$,space%+1)
P%=
params$,"\")
P%>0
6 name$=
filename(
params$,P%-1),"PrintJobs",-1)
params$=
params$,P%+1)
name$=""
$ params$=
get_input(params$,f%)
command$<>"!MESSAGE"
params$=
u(params$)
state%=(params$="ON")
command$
@
Do nothing - probably a blank line at end of file
"!SCRIPT":
ImpCom$=""
params$
:
"QUIET":
Do nothing. No confirmation required
"","POWERBASE":
>
confirm(
msg("Err68,"+
leaf(f$)))
finished%=
"END":finished%=
2 file$=
filename(params$,"PrintRes",&fff)
.
file$<>""
execute_script(file$)
!
"!COMMENT":
Do nothing
"!MESSAGE":
params$<>""
T%=
params$))
$
T%>0
params$=
params$)
$
inform(
params$,80),0,T%)
close_it(informW%)
"!SELECTION":
params$<>""
2 file$=
filename(params$,"PrintRes",&7f3)
file$=""
3
read_items_from_list(params$,"select")
$
load_selection(file$)
clear_selection
"!PRINTOPTS":
params$<>""
2 file$=
filename(params$,"PrintRes",&7f5)
=
file$<>""
get_options(printW%,printerW%,file$)
?
"OS_File",5,$database%+".PrintRes.!PrintOpts"
d%=1
M
get_options(printW%,printerW%,$database%+".PrintRes.!PrintOpts")
N
get_options(printW%,printerW%,"<Pbase$Dir>.Resources.!PrintOpts")
"!SUBFILES":
ic%=6
deselect(queryW%,ic%)
params$+=",":I%=0
I%+=1
P%=
params$,",")
4 par$=
params$,P%-1):params$=
params$,P%+1)
$
select(queryW%,
(par$)+6)
params$=""
-
"!CASE":
set_icon(queryW%,1,state%)
"!QUERY":
I
(format$="table"
format$="label")
selected(printW%,25)
>
moan_err%,
msg("Err208,"+format$+","+reportdest$)
params$<>""
4 file$=
filename(params$,"PrintRes",&7f4)
I
file$<>""
"OS_File",255,file$,Query%
$Query%=params$
default_query
8
$Query%=""
displayed%=REC%
displayed%=-1
Search$=
parse
name$=""
L
displayed%=-1
name$=
query$,NameLength%)
name$="Displayed"
4 TextName$=$database%+".PrintJobs."+name$
TextName$=name$
reportdest$
+
"Window":$SaveName%=TextName$
"File":
C texthandle%=
(TextName$):
"OS_File",18,TextName$,&fff
ImpCom$<>""
-
firstquery%=
:firstquery%=
'
#texthandle%,ImpCom$
"
do_it(Search$,displayed%)
"
"!FILTER","!FILTEROPEN":
params$<>""
2 $Query%=params$:Filter$=
parse:filter%=
select(keypadW%,22)
8 U
field%(buttonfield%(0,22))>0
select(mainW%,field%(buttonfield%(0,22)))
" addr=
moveto(key%,top,1)
* filter%=
deselect(keypadW%,22)
W
field%(buttonfield%(0,22))>0
deselect(mainW%,field%(buttonfield%(0,22)))
Y
command$="!FILTEROPEN"
position_window(filterW%,0,0,0,0,0,0):$Query%=params$
"!SAVE":
/ file$=
filename(params$,"PrintJobs",-1)
?
save(file$,&fff,SHtextptr%,SHtextptr%+Count%*LenLine%)
"!CSV":
params$<>""
2 file$=
filename(params$,"PrintRes",&7f4)
G
file$<>""
"OS_File",255,file$,Query%
$Query%=params$
default_query
:
name$=""
name$=$database%+".PrintJobs.CSVfile"
6
$Query%=""
displayed%=REC%
displayed%=-1
$
write_csv(name$,displayed%)
"!INCLUDE","!EXCLUDE":
0 file$=
filename(params$,"PrintRes",&fff)
_
file$=""
read_items_from_list(params$,"mark")
read_keys_from_file(file$,"mark")
command$
8 &
"!INCLUDE":z%=
:spr$="yes"
8!%
"!EXCLUDE":z%=
:spr$="no"
8"
8#/
tick(markM%,0,z%):
tick(markM%,1,
8$% $
val(markW%,0)="Snull,"+spr$
warn_of_marks
8&3
"!CLEAR":
clear_marks(RA%):
warn_of_marks
"!FORMAT":
8(3
deselect(printW%,
selected_esg(printW%,3))
params$,1)
"V":format$="vert"
"T":format$="table"
"L":format$="label"
:format$="horiz"
8.
set_format(format$)
"!DESTINATION":
813
deselect(printW%,
selected_esg(printW%,4))
params$,1)
83)
"F":ic%=23:reportdest$="File"
84,
"P":ic%=25:reportdest$="Printer"
85'
:ic%=22:reportdest$="Window"
86A TextName$=$database%+".PrintJobs."+
query$,NameLength%)
87
select(printW%,ic%)
set_dest_sprite
8:0
shade(printW%,42,
selected(printW%,25))
8;/
"!EXPAND":
set_icon(printW%,5,state%)
8<.
"!DATE":
set_icon(printW%,11,state%)
8=.
"!UPPER":
set_icon(printW%,6,state%)
8>0
"!HEADER":
set_icon(printW%,28,state%)
8?0
"!FOOTER":
set_icon(printW%,29,state%)
8@.
"!FIRST":
set_icon(printW%,4,state%)
8A0
"!SHRINK":
set_icon(printW%,24,state%)
"!HEADINGS":
8C3
deselect(printW%,
selected_esg(printW%,1))
params$
"D":ic%=2
"T":ic%=1
:ic%=36
8H
select(printW%,ic%)
8J-
"!TITLE":$
text(printW%,10)=params$
8K+
"!PAGE":$
text(printW%,9)=params$
8L.
"!SPACER":$
text(printW%,26)=params$
8M1
"!TEXTWIDTH":$
text(printW%,18)=params$
"!ORIENTATION":
8O7
deselect(printerW%,
selected_esg(printerW%,1))
params$
8Q7
"SIDEWAYS","LANDSCAPE":
select(printerW%,4)
8R
select(printerW%,3)
8S
"!PRINTCOLUMNS":
8U7
deselect(printerW%,
selected_esg(printerW%,9))
params$
8W%
"2":
select(printerW%,81)
8X%
"3":
select(printerW%,85)
8Y%
"4":
select(printerW%,86)
8Z!
select(printerW%,80)
8\4
"!HEADERFONT":$
text(printerW%,57)=params$
8]2
"!BODYFONT":$
text(printerW%,71)=params$
"!FONTSIZE":
8_7
deselect(printerW%,
selected_esg(printerW%,7))
(params$)
8a#
select(printerW%,61)
8b$
select(printerW%,62)
8c$
select(printerW%,63)
8d$
select(printerW%,64)
8e(
text(printerW%,65)=params$
8f
8g6
"!LMARGIN","!RMARGIN","!TMARGIN","!BMARGIN":
deselect(printerW%,68)
8i& params$=
change_units(params$)
command$
"!LMARGIN":ic%=14
"!RMARGIN":ic%=15
"!TMARGIN":ic%=16
"!BMARGIN":ic%=18
8o
8p% $
text(printerW%,ic%)=params$
8q+
"!PMARGINS":
select(printerW%,68)
8r3
"!LINESPACE":$
text(printerW%,56)=params$
"!TABLE":
params$+=","
I%=1
P%=
params$,",")
8w4 par$=
params$,P%-1):params$=
params$,P%+1)
8x" par$=
get_input(par$,f%)
par$<>""
8{+
text(printerW%,23)=par$
8|D
2:par$=
change_units(par$):$
text(printerW%,24)=par$
8}+
text(printerW%,69)=par$
"!LABEL":
params$+=",":I%=0
I%+=1
P%=
params$,",")
4 par$=
params$,P%-1):params$=
params$,P%+1)
" par$=
get_input(par$,f%)
par$<>""
=
deselect(printerW%,
selected_esg(printerW%,5))
par$
+
"1":
select(printerW%,28)
+
"2":
select(printerW%,29)
+
"3":
select(printerW%,30)
'
select(printerW%,53)
D
2:par$=
change_units(par$):$
text(printerW%,32)=par$
D
3:par$=
change_units(par$):$
text(printerW%,34)=par$
+
text(printerW%,51)=par$
+
text(printerW%,52)=par$
+
text(printerW%,55)=par$
A
text(printerW%,78)=par$:
select(printerW%,39)
+
text(printerW%,40)=par$
9
set_icon(printerW%,41,(
u(par$)="ON"))
params$=""
0
"!COPIES":$
text(printerW%,45)=params$
P
"!SORT":$
text(printW%,44)=params$:
set_icon(printW%,46,(params$<>""))
"!IMPRESSION":
P%=
params$," ")
P%>0
= ImpCom$=
params$,P%-1):modifier$=
params$,P%+1))
modifier$
'
"NOT FIRST":firstquery%=
ImpCom$=params$
"!DELETE","!MOVE":
*
command$="!DELETE"
z%=0
z%=1
present%=7
3
select(searchW%,6):
deselect(searchW%,5)
2 file$=
filename(params$,"PrintRes",&fff)
e
file$=""
read_items_from_list(params$,"delete")
read_keys_from_file(file$,"delete")
" addr=
moveto(key%,top,1)
"!INSERT":
present%=7
0 subfile%=
(params$):top=8*subfile%+LH%
make_new_rec
loop%=1
fields%
) $Rf%(loop%)=
#F,len%(loop%))
write(fields%,key%)
top=8*file%+LH%
asterisk(
"!CHANGE":
params$<>""
P%=
params$,",")
2 F$=
params$,P%-1):params$=
params$,P%+1)
* F%=
field(X%,F$,
):Menufield%=F%
P%=
params$,",")
5 from$=
params$,P%-1):params$=
params$,P%+1)
P%=
params$,",")
P%>0
5 to$=
params$,P%-1):$Query%=
params$,P%+1)
to$=params$
'
changes(key%,F%,from$,to$,
"!OBEY":
P%=
params$," ")
G
P%>0
oscli$=
params$,P%):params$=
params$,P%+1)
oscli$=""
0 file$=
filename(params$,"PrintRes",&feb)
D
file$<>""
"OS_CLI",oscli$+file$
"OS_CLI",params$
"
"!KEY":
set_key(params$)
"!INDEX":
params$=""
2
read_items_from_list(indexes$,"remove")
C
read_items_from_list(params$,"index"):indexes$=params$
"!STARTAT":
params$=""
, starthere%=field%(
first_writable)
4
$StartHere%=params$:starthere%=
start_at
'
set_caret(0,mainW%,starthere%)
softerror(command$,46)
finished%=
"Hourglass_Smash"
close_file(F)
close_it(informW%)
set_caret(0,mainW%,starthere%)
get_input(S$,
flag%)
flag%=(
S$,"?")>0)
S$)<>"?"
$Prompt%=S$:$Params%=""
position_window(inputW%,0,0,0,0,0,0)
set_caret(0,inputW%,1)
poll(
input%
cancel%
quit%
close_it(inputW%)
set_caret(0,mainW%,starthere%)
input%=
:flag%=
=$Params%
change_units(params$)
ic%,units$
units$=
params$,2)
deselect(printerW%,
selected_esg(printerW%,8))
units$
"MM":units$="mm":ic%=48
"IN":units$="in":ic%=38
"PT":units$="pt":ic%=77
:units$="mm":ic%=48
select(printerW%,ic%)
convert_units
params$=
(params$))
=params$
filename(name$,default$,type%)
f$,s$,ftype%,d%,P%
name$="":f$=name$
name$,"::")>0,
name$,"<"):f$=name$
Full pathname (or one using system variable) stored. Leave it alone!
9 F
name$,".")=0:f$=$database%+"."+default$+"."+name$:
Leaf only
name$,1)="^":f$=$database%+"."+name$:
Pathname relative to dbase
"Beheaded" pathname. Glue correct head to body!
$ P%=
name$,"."):s$=
name$,P%-1)
P%=
$database%,s$)
f$=
$database%,P%-1)+name$
type%=-1
"XOS_File",5,f$
d%,,ftype%
d%=0
ftype%=(ftype%>>8)
&fff
type%>0
type%<>ftype%
read_keys_from_file(f$,action$)
F,key$
close_file(F):
wimp_error(
key$=
action$
'
"delete":
delete_record(key$)
9 #
"mark":
flag_record(key$)
close_file(F)
read_items_from_list(list$,action$)
Fieldnumber%,P%,X%,L%,item$,sep$,F$
sep$=",":list$+=sep$
action$="select"
printorder$=""
list$<>""
P%=
list$,sep$)
item$=
list$,P%-1)
9. item$=
get_input(item$,f%)
item$<>""
L%=0
action$
92*
"delete":
delete_record(item$)
93&
"mark":
flag_record(item$)
"select":
item$
960
"RECORD":
update_selection(
,"00")
97-
"KEY":
update_selection(
,"KK")
981
"SUBFILE":
update_selection(
,"SF")
9:+ Fieldnumber%=
field(X%,item$,
9;#
update_selection(
"index":
9>7 keyfield%()=0:keyfield%(0)=
field(X%,item$,
L%=
(item$)
L%>0
item$=
item$,2)
(item$)=0
9D#
L%=len%(keyfield%(0))
9FJ $
text(keyW%,12)=item$:$
text(keyW%,13)="0":$
text(keyW%,14)="L"
9G $
text(keyW%,15)=
create_index(key%,
set_key(item$)
9J+
"remove":
remove_index(item$,
9K
9L
list$=
list$,P%+1)
action$="select"
select_them(
delete_record(key$)
RecF%=
addr=
find(key$,0,
RecF%
addr=
shift(z%,0,0)
flag_record(key$)
P%,REC%,k$
find(key$,0,
P%>=0
REC%=
rec_no(k$,key%,P%)
9]& SHmarkptr%?REC%=1:MarkedRecs%+=1
abort_script
close_file(F)
format$="":reportdest$=""
softerror("",57)
wimp_error(
"Impulse" handling -----------------------------------------------
Impulse_command_received(token%,params%,object%)
9nDSHImpulseptr%=
extend_named_sliding_block(transanchor%,SHclaim%)
9o4param$=
getstr(params%):object$=
getstr(object%)
object$=""
object$=
leaf($database%)
token%
9r@
### GetPathname. Returns full pathname of object ###
leaf($database%)
object$:
9u<
"Impulse_SendMessage",&202,$database%,,,,,mytask%
"No data":
9wD
"Impulse_SendMessage",&202,"No database open",,,,,mytask%
9yT
"Impulse_SendMessage",&202,"Current database is not "+object$,,,,,mytask%
9{:
### Selection. Returns maximum data length ###
ClientSep$=
param$,1)
9}@ ClientForm$=
find_fields(param$,ClientSep$,ClientLengths$)
9~>
"Impulse_SendMessage",&202,ClientLengths$,,,,,mytask%
### ParseQuery. Returns title generated by FNparse ###
) $Query%=param$:ClientSearch$=
parse
"Impulse_SendMessage",&202,Title$,,,,,mytask%
### GetRecord. Returns data specified in Selection according to criteria specified in ParseQuery ###
< datalength%=
prepare_next_record(param$,SHImpulseptr%)
"Impulse_SendMessage",&202,"Ready to receive?",-1,,,transtag%,mytask%,Length%
### PutRecord ###
"Impulse_SendMessage",&201,"GetRecord",,,,getrec%,my task%
### ExpandCode ###
P%=
param$," ")
. code$=
param$,P%-1):table$=
param$,P%+1)
"Impulse_SendMessage",&202,
expand(code$,table$,L%,SF$,C%),,,,,mytask%
7,8:
### GetField, GetExpanded ###
params%<>-1
6 datalength%=
prepare_next_field(token%,param$)
\
"Impulse_SendMessage",&202,"Ready to receive?",-1,,,transtag%,mytask%,datalength%
:
### Max. length for a Powerbase field is 246 ###
### NextMatch ###
finished%
#
move_on_and_continue(key%)
M $
text(mergeW%,6)="Merging complete. Final page will appear shortly."
redraw_icon(mergeW%,6)
move_on_and_continue(key%)
S$,J%,F%,F1%
7addr=
next_match(addr,direction%,Filter$,finished%)
finished%
F$()="":
J%=0
8 F1%=KF%(key%,J%):
F1%<>F%
F%=F1%:S$+=F$(F%)+" "
text(mergeW%,6)=
S$,80):
redraw_icon(mergeW%,6)
Impulse_reply(replytag%,reply%)
abort_merge:
DSHImpulseptr%=
extend_named_sliding_block(transanchor%,SHclaim%)
reply$=
getstr(reply%)
replytag%
getrec%:
### Reply to GetRecord command. ###
"Impulse_FetchData",SHImpulseptr%,Length%,,,,,mytask%
mergetag%:
### Merging application replies when all data in document merged ###
selected(mergeW%,3)
"Impulse_SendMessage",&201,":"+$mergewith%+"."+document$+" Print",,,,printtag%,mytask%
display(key%,addr)
printtag%:
### Merging application has printed the current document ###
1 mergenum%+=1:$
text(mergeW%,7)=
(mergenum%)
redraw_icon(mergeW%,7)
selected(mergeW%,3)
finished%
addr=
moveto(key%,addr,direction%)
abort_merge
close_file(dbasehandle%)
addr=ClientPtr%:merging%=
deselect(mergeW%,3)
close_it(mergeW%)
softerror("",27)
wimp_error(
Impulse_send(tag%,maxsize%)
send%,flag%
tag%<>transtag%
moan_err%,
msg("Err216"):
datalength%>maxsize%:
send%=maxsize%
datalength%-=maxsize%
flag%=
datalength%=0
send%=0
send%=maxsize%
datalength%<maxsize%
transptr%!datalength%=0
datalength%+=4
datalength%=0
"Impulse_TransmitData",transptr%,send%,,,,,mytask%
flag%
transptr%+=send%
Impulse_receive(replytag%,expected%,received%)
I%,F%,P%
transbuff%=SHImpulseptr%
transbuff%?received%=13
data$=$transbuff%
### Acknowledge data received (get reason code 19 otherwise!) ###
"Impulse_SendMessage",&202,,,,,replytag%,mytask%
data$<>""
P%=
data$,"#")
REC%=
data$,P%-1))
data$=
data$,P%+1)
REC%=-1
REC%=RA%
read(
,fields%,REC%<>RA%,REC%,$database%)
I%=1
(ClientForm$)
$ F%=
fnum(
ClientForm$,I%,2))
<
data$<>""
$Rf%(F%)=
get_string(data$,ClientSep$)
write(fields%,key%)
received%=0
"Impulse_SendMessage",&201,"GetRecord",,,,getrec%,mytask%
get_string(
S$,sep$)
P%,F$
S$,sep$)
P%>0
F$=
S$,P%-1)
S$=
S$,P%+1)
stripright(F$," ")
prepare_next_record(key$,transbuff%)
ok%,I%,F%,P%
dbasehandle%=0
, dbasehandle%=
($database%+".Database")
' ClientPtr%=
neighbour(key%,top,1)
P%=transbuff%
key$
"***":
close_file(dbasehandle%)
$P%=key$:P%+=
($P%)+1
ok%=
ClientPtr%<>top
( REC%=
rec_no(k$,key%,ClientPtr%)
'
readsmarray(dbasehandle%,REC%)
(ClientSearch$)=
$ $P%=
(REC%)+"#":P%+=
($P%)
: %
I%=1
(ClientForm$)
( F%=
fnum(
ClientForm$,I%,2))
, $P%=F$(F%)+ClientSep$:P%+=
($P%)
ok%=
0 ClientPtr%=
neighbour(key%,ClientPtr%,1)
P%=transbuff%
close_file(dbasehandle%)
" val$=
type(key%):kl%=
(key$)
% ClientPtr%=
search(key$,key%,1)
ClientPtr%>=0
( REC%=
rec_no(k$,key%,ClientPtr%)
'
readsmarray(dbasehandle%,REC%)
" $P%=
(REC%)+"#":P%+=
($P%)
#
I%=1
(ClientForm$)
& F%=
fnum(
ClientForm$,I%,2))
* $P%=F$(F%)+ClientSep$:P%+=
($P%)
$P%+=ClientSep$:P%+=1
=P%-transbuff%
prepare_next_field(method%,S$)
C%,L%,F%,P%,len%,T$,F$,V%,R%,b$,k$,SF$,blobloaded%,X%,exp$
method%=8
P%=
S$,",")
:&(
P%>0
exp$=
S$,P%):S$=
S$,P%-1)
:('F%=
field(X%,S$,
):V%=chartype%(F%)
:*z
0,1,2,3,4,5,6,7,8,46,47,48,49,50,51,52,53,54,55,56,57,58,63,68,69,70,71,72,73,74,75,76,77,78,79:F$=F$(F%):L%=
:+#
method%=8
link$(F%)<>""
:,< F$=
expand(F$(F%),link$(F%)+exp$,L%,SF$,C%):L%=
36,39:
R%=
rec_no(k$,key%,addr)
:0- L%=
blob_path(
,$database%,R%,F%,V%,b$)
L%>0
:27 SHImpulseptr%=
claim_page(transanchor%,L%+1024)
:3<
"OS_File",255,b$,SHImpulseptr%:SHImpulseptr%?L%=0
blobloaded%=
:62
41,42,43,61,62:F$=F$(F%):L%=
no_yes(F%,F$)
blobloaded%
$SHImpulseptr%=F$
SHImpulseptr%?L%=0:L%+=1
len%=(L%+4)
&FFFFFFFC
L%<len%
SHImpulseptr%?L%=0
L%+=1
transptr%=SHImpulseptr%
:? =len%
start_merge(wi%)
Impulse_wait%=
text(wi%,1)=document$:
redraw_icon(wi%,1)
text(wi%,4)="Merge"
text(wi%,6)="":$
text(wi%,7)=""
deselect(wi%,12)
position_window(wi%,-1,-1,0,0,0,0)
set_caret(0,wi%,9)
finished%=
merge_next(filter%,key%,P%)
S$,J%,F%,F1%
complete(5)
P%=top
finished%
selected(mergeW%,3)
filter%
:R. dbasehandle%=
($database%+".Database")
:S# record%=
rec_no(k$,key%,P%)
:T*
readsmarray(dbasehandle%,record%)
:U!
close_file(dbasehandle%)
J%=0
:X: F1%=KF%(key%,J%):
F1%<>F%
F%=F1%:S$+=F$(F%)+" "
:Z7 $
text(mergeW%,6)=
S$,80):
redraw_icon(mergeW%,6)
:[d
"Impulse_SendMessage",&201,":"+$mergewith%+"."+document$+" Merge",0,0,0,mergetag%,mytask%,0
End of "Impulse" handling -------------------------------------------
Import/Export CSV files ---------------------------------------------
start_import(type$,wi%)
T%,F,filename$,S$,fieldinfo%
filename$=$
text(csvW%,13)
:f(F=
(filename$):S$=
close_file(F)
fieldinfo%=(
S$,"|")>0)
fieldinfo%=
present%=0
softerror("",69):
fieldinfo%=
present%>0
softerror("",172):
present%=7
Modify%=
softerror("",14):
"Wimp_GetPointerInfo",,block%:x%=!block%:y%=block%!4
T%=0
LastTable%
:m)
wi%=tableW%(T%)
Tablenumber%=T%
wi%
:p
-2:csvfunc$="ImportMain"
:qH
present%=0
select(csvW%,1):
select(csvW%,4):
shade(csvW%,4,
:r+
mainW%,markW%:csvfunc$="ImportMain"
:s4
tableW%(Tablenumber%):csvfunc$="ImportTable"
:t7
scrollerW%(Scroller%):csvfunc$="ImportScroller"
filename$=$
text(csvW%,13)
shade(csvW%,0,
:x&$CSVTitle%="Import "+type$+" file"
text(csvW%,9)="Import"
wi%=mainW%
:{5
position_window(csvW%,x%-350,y%-260,0,570,0,0)
:|+
position_window(csvW%,0,0,0,0,0,0)
auto_csv(on%)
R4%,f$,S$,vers%
on%
present%=7
$Reformatted%=""
" f$=$database%+".PrintJobs"
R4%<>-1
8
"OS_GBPB",9,f$,block%,1,R4%,255
,,S$,,R4%
.
S$,7)="NewData"
vers%=
S$,2))
) f$+=".NewData"+
(vers%+1),2)
autocsvhandle%=
"OS_File",18,f$,&dfe
"
select_range(1,fields%,
csvform$=printorder$
clear_selection
autocsvhandle%>0
close_file(autocsvhandle%)
write_csv(Filename$,displayed%)
P%,rec%,examined%,subtotal%,sel$,default%
writingcsv%
printorder$=""
, sel$=$database%+".PrintRes.!Selection"
"OS_File",5,sel$
default%
default%=1
load_selection(sel$)
printorder$<>""
selected(csvW%,3)
Form$=printorder$
softerror("",34):
end_csv:
*s$=$
text(printW%,26):s%=
(s$):c$=
s%=0:spacer$=s$
c$<"0"
c$>"9":spacer$=
s%,c$)
:spacer$=
s%," ")
)csvhandle%=
(Filename$):writingcsv%=
selected(csvW%,1)
csv_head
*dbasehandle%=
($database%+".Database")
Search$=
parse
!direc%=
selected(queryW%,4)+1
displayed%>=0:
readsmarray(dbasehandle%,displayed%)
write_csv_rec(REC%,Form$,csvhandle%)
usekey%=-1,
selected(savesubW%,6):
scan_marked_subfiles("P%<>top",key%,3,direc%,
scan_marked_subfiles("P%<>top AND k$=useval$",usekey%,3,1,
close_file(csvhandle%)
close_file(dbasehandle%)
"OS_File",18,Filename$,&dfe
writingcsv%=
close_it(savesubW%)
default%=1
clear_selection
end_csv
"Hourglass_Smash"
close_file(csvhandle%)
close_file(dbasehandle%)
"OS_File",18,Filename$,&dfe
writingcsv%=
softerror("",41)
wimp_error(
csv_head
I%,F%,f$,H$,Head$,N%
I%=-1
(Form$)-1
( I%+=2:F%=
fnum(
Form$,I%,2)):N%+=1
selected_esg(printW%,1)
1:Head$=Tag$(F%)
,
2:Head$=$
text(mainW%,(desc%(F%)))
36:Head$=""
selected(csvW%,4)
Head$=
(chartype%(F%))+"|"+
(len%(F%))+"|"+$
text(mainW%,(desc%(F%)))+"|"+Tag$(F%)
chartype%(F%)<>3
chartype%(F%)<>6
selected(csvW%,0)
Head$=""""+Head$+""""
N%>1
Head$=sep$+Head$
#csvhandle%,Head$;
#csvhandle%,term$;
write_csv_rec(R%,Form$,handle%)
C%,I%,F%,f$,F$,L%,N%,V%,filename$,len%,base%,SF$,first%,pending%
selected(csvW%,3)
F$=
key2(0,1)
F$=
add_quotes(F$)
Form$<>""
F$+=sep$
#handle%,F$;
selected(csvW%,22)
#handle%,
(REC%)+sep$;
I%=-1:L%=
(Form$)-1
first%=
I%<L%
" I%+=2:F%=
fnum(
Form$,I%,2))
concat%
first%:
= F$=F$(F%):
F$<>""
selected(csvW%,2)
F$+=spacer$
pending%=
:first%=
concat%:
>
F$(F%)<>""
selected(csvW%,2)
F$+=F$(F%)+spacer$
pending%=
pending%:
6
F$(F%)<>""
selected(csvW%,2)
F$+=F$(F%)
pending%=
:first%=
n%=
(spacer$)
,
F$,n%)=spacer$
(F$)-n%)
N%+=1
'
F$<>""
selected(csvW%,2)
F$=
add_quotes(F$)
N%>1
F$=sep$+F$
#handle%,F$;
V%=chartype%(F%)
36,39:
. len%=
load_blob($database%,R%,F%,36)
)
len%>0
selected(csvW%,2)
* N%+=1:
N%>1
#handle%,sep$;
2
selected(csvW%,0)
#handle%,"""";
'
blob_to_file(handle%,len%)
2
selected(csvW%,0)
#handle%,"""";
.
3,6,46,47,54,56,57,74,75,77,78,79:
F$=F$(F%):N%+=1
)
F$<>""
selected(csvW%,2)
N%>1
F$=sep$+F$
#handle%,F$;
41,42,43,61,62:
F$=F$(F%):N%+=1
Z%=
no_yes(F%,F$)
F$=
add_quotes(F$)
N%>1
F$=sep$+F$
#handle%,F$;
64,65,66,67:
( N%+=1:
N%>1
#handle%,sep$;
0
selected(csvW%,0)
#handle%,"""";
! S%=
scroller_number(F%)
pending%(S%)=
pending%(S%)
: F$=
read_scroller_row(REC%,F%,S%,V%-63,
,sep$)
)
selected_esg(printW%,6)
/
pending%(S%)
F$+=scrollterm$
#handle%,F$;
#handle%,F$;
pending%(S%)
R
selected(csvW%,0)
#handle%,""""+sep$+"""";
#handle%,sep$;
;"0
selected(csvW%,0)
#handle%,"""";
;$"
selected(printW%,5)
;%4 F$=
expand(F$(F%),link$(F%),Len%,SF$,C%)
F$=F$(F%)
N%+=1
;))
F$<>""
selected(csvW%,2)
F$=
add_quotes(F$)
N%>1
F$=sep$+F$
#handle%,F$;
;.
#handle%,term$;
add_quotes(F$)
selected(csvW%,0)
=""""+F$+""""
convert_csv(f$)
k$,B%,J%,fld%,S$,sep%,sep2%,term%,term2%,F$,avail%,nextfree%,keybase%,base%,base2%,show%,done%,display%,abort%
importingcsv%
importingcsv%=
stop_reading:
;==SHmisc%=
extend_named_sliding_block(tempanchor%,SHclaim%)
;>:sep%=
(sep$):
(sep$)=2
sep2%=
sep$))
sep2%=255
;?@term%=
(term$):
(term$)=2
term2%=
term$))
term2%=255
csvhandle%=
present%=0
csv_to_dbase(f$):
abort%
Form$=
csv_importform
;C3toobighandle%=
($database%+".PrintJobs.TooBig")
"Hourglass_On"
;E display%=
selected(csvW%,11)
limit_actions(
,multitask%)
selected(csvW%,24)
addr=top
;J7
selected(csvW%,24):
Modify existing records
;K$ addr=
neighbour(key%,addr,1)
;L/
addr=top
moan_err%,
msg("Err131")
;M" REC%=
rec_no(k$,key%,addr)
;N1
read(display%,fields%,
,REC%,$database%)
;O2
selected(csvW%,22):
With record number
read_bytes
REC%=
($base%)
;R1
read(display%,fields%,
,REC%,$database%)
;S/
selected(csvW%,3):
With primary key
read_bytes
;U* addr=
find(
$base%,KL%(key%)),0,
addr>0
;W$ REC%=
rec_no(k$,key%,addr)
;X3
read(display%,fields%,
,REC%,$database%)
make_new_rec
;Z
make_new_rec
endline%=
:J%=-1
;^#
(Form$)-2
endline%=
;_& J%+=2:fld%=
fnum(
Form$,J%,2))
;`!
transfer_csv_field(fld%)
;bC
fld%<=fields%
(endline%
#csvhandle%)
next_csv_rec
write(fields%,key%)
;d"
display%
redraw(mainW%)
;e?
"Hourglass_Percentage",
#csvhandle%*100
#csvhandle%
#csvhandle%
"Hourglass_Off"
close_file(csvhandle%)
close_file(toobighandle%)
"OS_File",18,$database%+".PrintJobs.TooBig",&fff
addr=
moveto(key%,top,1)
clear_selection
asterisk(
write_log(-1,"CSV data imported from file:",f$)
importingcsv%=
save_keys
limit_actions(Access%,multitask%)
make_new_rec
;u-keybase%=SHkeyptr%(0):nextfree%=!keybase%
!(keybase%+nextfree%)<=0
incr%=
($Increment%)
incr%>0
;y#
change_length(RA%+incr%,
;z1 keybase%=SHkeyptr%(0):nextfree%=!keybase%
;{#
moan_err%,
msg("Err66")
;~)REC%=!(keybase%+nextfree%+8+KL%(0)+1)
read(display%,fields%,
,RA%,$database%)
transfer_csv_field(
fld%)
C%,L%,P%,Q%,R%,T%,R$,S$,ic%,wi%,p%,z$
chartype%(fld%)
64,65,66,67:
read_bytes
ptr%>0
4 S%=
scroller_number(fld%):wi%=scrollerW%(S%)
8 cols%=scrolldata%(S%,8):icons%=scrolldata%(S%,6)
( P%=-1:Q%=base%:T%=
(scrollterm$)
P%+=1
!
base%?P%=T%
P%=ptr%
* base%?P%=13:R$=$Q%:Q%=base%+P%+1
C%=0
cols%-1
2 p%=
R$,sep$):S$=
R$,p%-1):R$=
R$,p%+1)
, ic%=R%*cols%+C%:L%=sclen%(S%,C%)
I
ic%=icons%-1
P%<ptr%
icons%=
add_row(S%,wi%,R%+2,cols%)
# $
text(wi%,ic%)=
S$,L%)
R%+=1
P%=ptr%
"
write_scroller(REC%,fld%)
36,39:
read_bytes
ptr%>0
3 Z%=
blob_path(
,$database%,REC%,fld%,36,F$)
$ Start%=base%:End%=base%+ptr%
"
save(F$,&fff,Start%,End%)
display%
chartype%(fld%)
?
set_blob_sprite(REC%,fld%,chartype%(fld%),z$)
,
show_text_block(fld%,REC%)
41,42,43,61,62:
read_bytes:c$=
pos_neg(fld%,$base%)
F
" ":$Rf%(fld%)=" ":
display%
select(mainW%,field%(fld%))
F
"":$Rf%(fld%)="":
display%
deselect(mainW%,field%(fld%))
"@":
#toobighandle%,"Rec."+
(REC%)+",Fld."+
(fld%)+","+$base%+" unsuitable data for check-box":$Rf%(fld%)="":
deselect(mainW%,field%(fld%))
0,1,2,3,4,5,6,7,8,46,47,48,49,50,51,52,53,54,55,56,57,58,60,63,68,69,70,71,72,73,74,75,76,77,78,79:
len%(fld%)>0
read_bytes
>
selected(csvW%,16)
$base%=
stripright($base%," ")
ptr%<=len%(fld%):
chartype%(fld%)=47
H
selected(csvW%,23)
$Rf%(fld%)=$base%:dontincrement%=
$Rf%(fld%)=$base%
ptr%<247:
C
#toobighandle%,"Rec."+
(REC%)+",Fld."+
(fld%)+","+$base%
$Rf%(fld%)="@"
#toobighandle%,"Rec."+
(REC%+1)+",Fld."+
(fld%)+" is more than 246 characters long. Data not saved. External field suggested."
$Rf%(fld%)="@"
fld%+=1
8
### Zero-length field is probably just a label
:fld%+=1
### Can't put CSV data into Button, Sprite or Draw fields! ###
changed%=
update_calcs(fld%)
read_bytes
end$,B%
base%=!tempanchor%
ptr%=-1
#csvhandle%
B%=34
O end$="(B%=sep% OR B%=term% OR EOF#csvhandle%=TRUE) AND base%?(ptr%-1)=34"
7 end$="B%=sep% OR B%=term% OR EOF#csvhandle%=TRUE"
#csvhandle%=
#csvhandle%-1
B%=
#csvhandle%
ptr%+=1:base%?ptr%=B%
(end$)
base%?(ptr%-1)=34
ptr%-=1
base%?ptr%=13
sep%:
skip_sep
term%:
skip_term
next_csv_rec
B%=
#csvhandle%
B%=term%
skip_term
skip_sep
sep2%<>255
B%=
#csvhandle%
B%<>sep2%
#csvhandle%=
#csvhandle%-1
skip_term
term2%<>255
B%=
#csvhandle%
B%<>term2%
#csvhandle%=
#csvhandle%-1
endline%=
endline%=
stop_reading
"Hourglass_Off"
close_file(csvhandle%)
close_file(toobighandle%)
close_file(dbasehandle%)
"OS_File",18,$database%+".PrintJobs.TooBig",&fff
=17
softerror("",74)
wimp_error(
present%=7
addr=
moveto(key%,top,1)
clear_selection
importingcsv%=
limit_actions(Access%,multitask%)
csv_importform
F%,f$,F$,X%,m$
endline%=
selected(csvW%,1):
### Use header record to build form ###
read_bytes
%
selected_esg(printW%,1)
-
1:F%=
field(X%,$base%,
):m$="tag"
0
2:F%=
dfield($base%):m$="descriptor"
)
moan_err%,
msg("Err136")
9
F%=0
moan_err%,
msg("Err87,"+m$+","+$base%)
f$=
~(F%)
(f$)=1
f$="0"+f$
F$+=f$
"
invert(mainW%,field%(F%))
endline%
printorder$<>"":
### Build form from highlighted fields, as in printing ###
F$=printorder$
### Assume entry into all fields, beginning with first ###
F%=1
fields%
f$=
~(F%)
(f$)=1
f$="0"+f$
F$+=f$
csv_to_dbase(f$)
F%,L%,LM%,P%,Q%,V%,F,S$,readpos%,width%
Desc$()
Desc$(MaxFields%)
read_bytes:S$=$base%:
#csvhandle%=0
S$,"|")=0
moan_err%,
msg("Err89")
leaf$=
leaf(f$):csvconv%=
$database%="No data"
$database%=leafnamepath$+".!"+leaf$
save($database%,0,0,0)
fields%=0:endline%=
fields%+=1
read_bytes:S$=$base%
<40 V%=
(S$):P%=
S$,"|"):S$=
S$,P%+1):L%=
<5'
L%>0
S$,"|"):S$=
S$,P%+1)
L%=0
L%=V%:V%=0
<7- chartype%(fields%)=V%:len%(fields%)=L%
P%=
S$,"|")
P%=0
<:. Desc$(fields%)=S$:Tag$(fields%)=
S$,4)
<;
<<: Desc$(fields%)=
S$,P%-1):Tag$(fields%)=
S$,P%+1,4)
<>& L%=
string_width(Desc$(fields%))
L%>LM%
LM%=L%
endline%
($database%+".Form")
#F,fields%
F%=1
fields%
xd%=16:xf%=xd%+LM%
yd%=-(F%*52):yf%=yd%
<F@ bbox%=
guess_width(len%(F%),chartype%(F%),width%)+(48<<16)
<GK
#F,Desc$(F%),Tag$(F%),xd%,yd%,xf%,yf%,len%(F%),chartype%(F%),0,bbox%
close_file(F)
"OS_File",18,$database%+".Form",&7f2
fields%=0:Fieldnumber%=0
fields%=
get_form(Fptr%)
default_key
readpos%=
#csvhandle%
no_of_recs
defaults($database%,RA%,0)
abort%
present%=0:importingcsv%=
save_keys
deselect(csvW%,1)
csvhandle%=
#csvhandle%=readpos%
<V=SHmisc%=
extend_named_sliding_block(tempanchor%,SHclaim%)
no_of_recs
N%,B%
#csvhandle%
B%=term%
#csvhandle%
N%+=1
<_?
"Hourglass_Percentage",
#csvhandle%*100
#csvhandle%
#csvhandle%
table_to_csv(T%,Filename$)
Rows%,TabFields%,Rec%,offset%,heading%,colours$
<eUt$=
table_info(T%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)
save_as_csv(Filename$,tableW%(T%),Rows%,TabFields%)
writetable%=
scroller_to_csv(S%,f$)
wi%,F%,icons%,cols%
wi%=scrollerW%(S%)
F%=scrolldata%(S%,0)
icons%=scrolldata%(S%,6)
cols%=scrolldata%(S%,8)
save_as_csv(f$,wi%,icons%
cols%,cols%-1)
writescroller%=
save_as_csv(f$,wi%,rows%,cols%)
csvhandle%,ic%,row%,column%,F$
csvhandle%=
ic%=-1
"Hourglass_On"
row%=0
rows%-1
column%=0
cols%
<{! ic%+=1:F$=$
text(wi%,ic%)
<|.
selected(csvW%,0)
F$=""""+F$+""""
<}.
column%<cols%
F$+=sep$
F$+=term$
#csvhandle%,F$;
column%
row%
"Hourglass_Off"
close_file(csvhandle%)
"OS_File",18,f$,&dfe
csv_to_table(T%,filename$)
ic%,row%,column%,Rows%,TabFields%,Rec%,offset%,heading%,csvhandle%,base%,F$,sep%,sep2%,term%,term2%
table_info(T%,Rows%,TabFields%,Rec%,tabfieldlen%(),offset%,heading%,colours$)
import_csv("T",filename$,tableW%(T%),Rows%,TabFields%)
csv_to_scroller(S%,filename$)
wi%,F%,icons%,cols%
wi%=scrollerW%(S%)
F%=scrolldata%(S%,0)
icons%=scrolldata%(S%,6)
cols%=scrolldata%(S%,8)
import_csv("S",filename$,wi%,icons%
cols%,cols%-1)
ScrollChanged%=
asterisk(
import_csv(to$,f$,wi%,rows%,cols%)
csvhandle%,sep%,sep2%,term%,term2%,base%,row%,column%,recs%,endline%
:sep%=
(sep$):
(sep$)=2
sep2%=
sep$))
sep2%=255
@term%=
(term$):
(term$)=2
term2%=
term$))
term2%=255
=SHmisc%=
extend_named_sliding_block(tempanchor%,SHclaim%)
base%=SHmisc%
csvhandle%=
to$="S"
recs%=
no_of_recs
#csvhandle%=0
recs%>rows%
row%=rows%+1
recs%
. icons%=
add_row(S%,wi%,row%,cols%+1)
row%
rows%=recs%
"Hourglass_On"
row%=0
rows%-1
- endline%=
:column%=0:ic%=row%*(cols%+1)
column%<=cols%
endline%=
#csvhandle%
read_bytes
: $
text(wi%,ic%)=
$base%,
buffer_length(wi%,ic%))
column%+=1:ic%+=1
(endline%
#csvhandle%)
next_csv_rec
row%
"Hourglass_Off"
close_file(csvhandle%)
redraw(wi%)
asterisk(
--- SLIDING HEAP 2.01 PROCEDURES
requires SlidingHeap 2.00 or later.
Current version is 2.01 (03-11-2002)
Made 32-bit compatible by Christopher Bazley
module and PROCs
Steven Haslam 1992
_heap_slotsize
"Wimp_SlotSize",-1,-1
_heap_pageup(n%)
"OS_ReadMemMapInfo"
=(n%+R0%-1)
(R0%-1)
initheaps(heapsize%,slidingblocks%)
fixedheapsize%=heapsize%
Lheap_trigger%=
_heap_pageup(
+fixedheapsize%+20+20*slidingblocks%-&8000)
setslotsize(heap_trigger%)
_heap_slotsize<heap_trigger%
130,"Unable to initialise heap"
fixedheapbase%=
%slidingheapbase%=
+fixedheapsize%
"OS_Heap",0,fixedheapbase%,,fixedheapsize%
"SlidingHeap_Create",slidingheapbase%,2,slidingblocks%
"SlidingHeap_VerifyHeap",slidingheapbase%
_heap_nextfree
nextfree%
"SlidingHeap_NextFree",slidingheapbase%
nextfree%
=nextfree%
destroyheaps
setslotsize(
-&8000)
_heap_wordup(x%)=(x%+3)
create_anchor(name$)
space%
space% 4+
name$+1
!space%=0
$(space%+4)=name$
=space%
create_named_sliding_block(anchor%,size%)
trysize%
size%=
_heap_wordup(size%)
7trysize%=
_heap_pageup(
_heap_nextfree+size%-&7FF4)
trysize%>heap_trigger%
setslotsize(trysize%)
_heap_slotsize<trysize%
#
setslotsize(heap_trigger%)
D
131,"Not enough room to create block """+$(anchor%+4)+""""
heap_trigger%=trysize%
"SlidingHeap_NewBlock",slidingheapbase%,anchor%,size%,anchor%+4
"SlidingHeap_VerifyHeap",slidingheapbase%
scrap_block(anchor%)
!anchor%=0
"SlidingHeap_ScrapBlock",slidingheapbase%,anchor%
1trysize%=
_heap_pageup(
_heap_nextfree-&7FFC)
trysize%<>heap_trigger%
setslotsize(trysize%)
heap_trigger%=trysize%
!anchor%=0
"SlidingHeap_VerifyHeap",slidingheapbase%
setslotsize(newsize%)
"Wimp_SlotSize",newsize%,-1
extend_named_sliding_block(anchor%,newsize%)
!anchor%=0
create_named_sliding_block(anchor%,newsize%):=!anchor%
!anchor%>
_heap_nextfree
129,"Block beyond heap limits"
$newsize%=
_heap_wordup(newsize%)
"SlidingHeap_DescribeBlock",slidingheapbase%,anchor%
,,oldsize%
larger%=newsize%>oldsize%
larger%
G trysize%=
_heap_pageup(
_heap_nextfree+(newsize%-oldsize%)-&7FFC)
trysize%>heap_trigger%
setslotsize(trysize%)
$
_heap_slotsize<trysize%
%
setslotsize(heap_trigger%)
=
132,"Not enough room to extend block #"+
~anchor%
heap_trigger%=trysize%
"SlidingHeap_ExtendBlock",slidingheapbase%,anchor%,newsize%
1trysize%=
_heap_pageup(
_heap_nextfree-&7FFC)
trysize%<>heap_trigger%
setslotsize(trysize%)
heap_trigger%=trysize%
"SlidingHeap_VerifyHeap",slidingheapbase%
=!anchor%
sliding_block_size(anchor%)
size%
"SlidingHeap_DescribeBlock",slidingheapbase%,anchor%
,,size%
=size%
claim_page(anchor%,needed%)
oldsize%,newsize%
=.)oldsize%=
sliding_block_size(anchor%)
needed%>oldsize%
newsize%=oldsize%
newsize%+=SHclaim%
newsize%>needed%
=48 ptr%=
extend_named_sliding_block(anchor%,newsize%)
=5(
clear_mem(ptr%,oldsize%,newsize%)
=!anchor%
clear_mem(ptr%,start%,end%)
I%=start%
end%-4
ptr%!I%=&20202020
print_init(dest$)
S%,Z%
check_record
=C@SHheadptr%=
extend_named_sliding_block(headanchor%,SHclaim%)
=D@SHtextptr%=
extend_named_sliding_block(textanchor%,SHclaim%)
=E>SHrecptr%=
extend_named_sliding_block(recanchor%,SHclaim%)
clear_mem(SHheadptr%,0,
sliding_block_size(headanchor%))
clear_mem(SHtextptr%,0,
sliding_block_size(textanchor%))
clear_mem(SHrecptr%,0,
sliding_block_size(recanchor%))
read_print_options(dest$,printW%,printerW%)
=J Count%=0:TextPtr%=SHtextptr%
S%=0
Scrollnum%-1
scrolldata%(S%,9)=0
=NBmaxlen%()=len%():truelen%()=0:diff%()=0:Tab2%()=0:maxlenP%()=0
=O-LenLineP%=0:pagecolumn%=0:header_lines%=0
direct_print(from%,to%)
I%,L%,N%,lastprintable%,term%,S$,M$,more%
pause%
pagenumber%>1
=Uc
confirm(
msg("Err219,"+
(pagenumber%)))
moan_err%,
msg("Err220")
"Hourglass_On"
fit_page
format$="vert"
LenLineP%=xlimit%
LenLineP%=
(maxlenP%())
term%=xlimit%
pointsize%
term%>400
term%=400
term%>LenLine%
term%=LenLine%-1
LenLineP%>xlimit%
=]/ newsize%=(pointsize%*xlimit%)
LenLineP%
=^G
newsize%<6
msg("Err196")
msg("Err197,"+
(newsize%))
format$
"horiz","table":
=a
=b8 lastprintable%+=1:L%+=maxlenP%(lastprintable%)
=c2
lastprintable%=PrintFields%
L%>xlimit%
L%>xlimit%
S$=" "
=f,
I%=lastprintable%
PrintFields%
=g( F%=
fnum(
Form$,(2*I%)-1,2))
S$+=Tag$(F%)+"\"
S$=
=k3
lastprintable%<PrintFields%
S$="s"+S$
=l
"vert":
I%=1
PrintFields%
=o& F%=
fnum(
Form$,(2*I%)-1,2))
=p;
maxlen%(F%)>L%
L%=maxlen%(F%):S$=" "+Tag$(F%)
pagenumber%=1
=ti
confirm(
msg("Err95,"+
(pointsize%)+","+S$+","+M$))=
printing%=
moan_err%,
msg("Err220")
=v#
lastprintable%=PrintFields%
format$="table"
xstart%+=4
"ColourTrans_SetGCOL",0,0,0,0,0
rect%=1
printcolumns%
origin%=origin%(rect%)
=|U
"PDriver_GiveRectangle",rect%,rectangle%,transform%,origin%(rect%),&FFFFFF00
rect%
"PDriver_DrawPage",copies%,rectangle2%,0,0
more%,,rect%
more%
( first%=from%+pagelength%*(rect%-1)
to%-first%+1<pagelength%
last%=to%
last%=first%+pagelength%-1
) TextPtr%=SHtextptr%+first%*LenLine%
draw_page
"PDriver_GetRectangle",,rectangle2%
more%,,rect%
sorton%=0
4 Count%=0:labcount%=0:pagecolumn%=0:Label$()=""
B SHtextptr%=
extend_named_sliding_block(textanchor%,SHclaim%)
clear_mem(SHtextptr%,0,
sliding_block_size(textanchor%))
TextPtr%=!textanchor%
draw_page
line%,xmax%,ymin%,rows%
&rows%=last%-first%-header_lines%+2
-ymin%=ystart%-(last%-first%)*linedepth%-8
format$
"label":
print_labels(xstart%,ystart%)
line%=first%
last%
*
print_line(xstart%,ystart%,xmax%)
TextPtr%+=LenLine%
line%
format$
"table":
table_grid(xmax%+spacerlen%,ymin%,rows%,tablecolumns%,tablecolumnwidth%)
"horiz":
vrules%
h%=linedepth%*(rows%+1)
# x%=xstart%-(spacerlen%
y%=ymin%+22
!
vertical_rules(x%,y%,h%)
print_line(x0%,y0%,
xmax%)
F%,P%,R%,chars%,width%,x%,x1%,y%,w%,font%,colour%,ptr%
+x%=x0%:y%=y0%-(line%-first%)*linedepth%
0SHrecptr%=!recanchor%:R%=SHrecptr%!(line%*4)
-1,-2:font%=headerfont%:colour%=headercol%
No font: rule
:font%=bodyfont%:colour%=bodycol%
TextPtr%?term%=13
R%=-3:
rule off
"Wimp_SetColour",rulewimpcol%
x%,y%+linedepth%
BY LenLineP%,0
R%=-2:
No columns: print whole line
font_print(TextPtr%,0,x%,y%,font%,colour%)
format$="vert":
chars%=Tab%(2)-Tab%(1)
5 w%=
how_wide("",TextPtr%,chars%,headerfont%,-1)
x%=x0%+maxlenP%(1)-w%
chars%>0
font_print(TextPtr%,chars%,x%,y%,headerfont%,headercol%):x%+=w%+8
! Q%=Tab%(2):ptr%=TextPtr%+Q%
P%=0
P%+=1
"
ptr%?P%=160
ptr%?P%=13
C
Check for concatenation. A CHR$(160) precedes next header
ptr%?P%=160
7
font_print(ptr%,P%,x%,y%,bodyfont%,bodycol%)
8 w%=
how_wide("",ptr%,P%,bodyfont%,-1):x%+=w%+8
ptr%+=P%:P%=0
P%+=1
ptr%?(P%+1)=160
5
"tail" of header ends with this character
=
font_print(ptr%,P%+1,x%,y%,headerfont%,headercol%)
: w%=
how_wide("",ptr%,P%,headerfont%,-1):x%+=w%+8
Q%=P%-1:ptr%+=P%+1
ptr%?P%=13
font_print(ptr%,0,x%,y%,bodyfont%,bodycol%)
Print in columns
F%=1
lastprintable%
width%=maxlenP%(F%)
P%=TextPtr%+Tab%(F%)
" chars%=Tab%(F%+1)-Tab%(F%)
numeric%(F%)
- w%=
how_wide("",P%,chars%,font%,-1)
x1%=(width%-w%)
x1%=0
6
font_print(P%,chars%,x%+x1%,y%,font%,colour%)
x%+=width%
x%>xmax%
xmax%=x%
get_document_size(
"PDriver_PageSize"
,w%,h%,l%,b%,r%,t%
"Font_ConverttoOS",,w%,h%
,w%,h%
"Font_ConverttoOS",,l%,r%
,l%,r%
"Font_ConverttoOS",,t%,b%
,t%,b%
fit_page
x%,y%,w%,column%
orientation$
"upright":
C w%=(right%-left%-(gutter%*(printcolumns%-1)))
printcolumns%
rectangle%!0=0
rectangle%!4=0
rectangle%!8=w%
rectangle%!12=top%-bottom%
column%=1
printcolumns%
5 x%=left%+(w%+gutter%)*(column%-1):y%=bottom%
P
"Font_Converttopoints",,x%,y%
,!origin%(column%),origin%(column%)!4
column%
transform%!0=(1<<16)
transform%!4=0
transform%!8=0
transform%!12=(1<<16)
< xstart%=4:ystart%=top%-bottom%-linedepth%:xlimit%=w%-8
"sideways":
C w%=(top%-bottom%-(gutter%*(printcolumns%-1)))
printcolumns%
rectangle%!0=0
rectangle%!4=0
rectangle%!8=w%
rectangle%!12=right%-left%
column%=1
printcolumns%
7 x%=right%:y%=bottom%+(w%+gutter%)*(column%-1)
P
"Font_Converttopoints",,x%,y%
,!origin%(column%),origin%(column%)!4
column%
transform%!0=0
transform%!4=(1<<16)
transform%!8=-(1<<16)
transform%!12=0
< xstart%=4:ystart%=right%-left%-linedepth%:xlimit%=w%-8
get_fonts
Eheaderfont%=
get_font($
text(printerW%,57),pointsize%,pointsize%)
Cbodyfont%=
get_font($
text(printerW%,71),pointsize%,pointsize%)
-keyfont%=
get_font("Homerton.Medium",4,4)
get_font(fontname$,width%,height%)
font%
"Font_FindFont",,fontname$,width%*16,height%*16
font%
=font%
declare_fonts
"PDriver_DeclareFont",headerfont%
"PDriver_DeclareFont",bodyfont%
"PDriver_DeclareFont",keyfont%
"PDriver_DeclareFont"
lose_fonts
"Font_LoseFont",headerfont%
"Font_LoseFont",bodyfont%
"Font_LoseFont",keyfont%
font_print(P%,L%,x%,y%,font%,fontcol%)
byte%,S$
L%=0
S$=$P%
byte%=P%?L%:P%?L%=13:S$=$P%:P%?L%=byte%
"ColourTrans_SetFontColours",font%,&ffffff00,fontcol%,14
"Font_Paint",font%,S$,16,x%,y%
how_wide(S$,P%,L%,font%,split%)
width%
"Font_SetFont",font%
>,Ablock%!0=0:block%!4=0:block%!8=0:block%!12=0:block%!16=split%
>/?
"Font_ScanString",font%,S$,(1<<5)+(1<<18),-1,-1,block%
>1J
"Font_ScanString",font%,P%,(1<<5)+(1<<7)+(1<<18),-1,-1,block%,,L%
width%=block%!28-block%!20
"Font_ConverttoOS",,width%
,width%
=width%+4
table_grid(x%,y%,rows%,columns%,colwidth%)
width%,height%,C%,R%
rows%<=0
>:*width%=x%-xstart%+4+colwidth%*columns%
height%=linedepth%*rows%
"Wimp_SetColour",rulewimpcol%
xstart%-4,y%,width%,height%
xstart%-4,y%-linedepth%
R%=1
rows%+1
>@4
BY 0,linedepth%:
BY width%,0:
BY -width%,0
vertical_rules(xstart%-(spacerlen%
2),y%,height%)
x%-colwidth%,y%
C%<columns%
C%+=1
>F5
BY colwidth%,0:
BY 0,height%:
BY 0,-height%
vertical_rules(x%,y%,height%)
"Wimp_SetColour",rulewimpcol%
x%,y%
F%<PrintFields%
>P8
BY maxlenP%(F%),0:
BY 0,height%:
BY 0,-height%
F%+=1
memory_usage
F,R,f$,S$,P%
f$=$database%+".MemoryUsed"
(f$):
F=0
#F,"Database: "+
leaf($database%)+" ("+
$+")"
#F,"(Record has "+
(fields%)+" fields and is "+
(Length%)+" [&"+
~(Length%)+"] bytes long)"
N%=((
)+1024)
1024
#F,"Program size: "+
(N%)+"K"
N%=((
P)+1024)
1024
#F,"Basic variables: "+
(N%)+"K"
N%=((
)+1024)
1024
("<Pbase$Dir>.!Run")
S$=
S$,8)="WimpSlot"
close_file(R)
S$,"K")-3
#F,"Program + variables: "+
(N%)+"K (Wimpslot = "+
S$,P%,4)+")"
>g@A%=indirectionmem%
1024:N%=((buff%-buffbase%)+1024)
1024
>hIM%=endbuff%-buff%:
M%<1024
(M%)+" bytes"
1024)+"K"
#F,"Icon indirection: "+
(A%)+"K allocated, "+M$+" left"
A%=menumem%
1024
>kLM%=men_end%-men_top%:
M%<1024
(M%)+" bytes"
1024)+"K"
#F,"Menus: "+
(A%)+"K allocated, "+M$+" left"
close_file(F)
"OS_File",18,f$,&fff
check_resources
f$,imissing$,rmissing$,rpath$,ipath$,d%
>sArpath$="<PBase$Dir>.Resources.":ipath$="<PBase$Dir>.Initial."
f$<>"*"
>w#
"OS_File",5,rpath$+f$
d%=0
>y%
"OS_File",5,ipath$+f$
>z_
d%=1
"OS_CLI","Copy "+ipath$+f$+" "+rpath$+f$+" ~C~V"
imissing$+=""""+f$+""","
f$
imissing$=
imissing$)
f$<>"*"
"OS_File",5,rpath$+f$
d%=0
rmissing$+=""""+f$+""","
rmissing$=
rmissing$)
imissing$<>""
0,imissing$+" missing from "+program$+".Initial. Please consult Powerbase Support"
rmissing$<>""
0,rmissing$+" missing from "+program$+".Resources. Please consult Powerbase Support"
!PrintOpts,Config,CSVoptions,FieldCols,Fkeys,GridOpts,Preference,*
Dial,Help,HelpReader,Info,Internet,KeyList,Messages,Sprites,Sprites22
Templates,UserMenu,ValStrings,Modules.ImpulseII,Modules.SlidingHp
Objects.Draw,Objects.Sprite,Objects.Text,Temp.!Run
Temp.!Sprites,Temp.!Sprites22,*
+Tools%=2:MaxLibs%=10:CustDir$=PbaseDir$
compare_paths(file$,database$)
P%,Q%,L%,C$,P$,T$,leaf$
Remotepath$="Absolute"
=file$
file$,"$"):Q%=
database$,"$")
file$,P%)<>
database$,Q%)
=file$
Not on same filing system: can't use relative path
leaf$=
leaf(file$)
leafnamepath$=database$+".PrintRes"
=leaf$
leafnamepath$=database$
leaf(database$)+"."+leaf$
P$="^."
P%+=1
C$=
file$,P%,1)
C$="."
L%=Q%:Q%=P%+1
C$<>
database$,P%,1)
file$,L%)
P%=
database$,".",P%+1)
P%>0
P$+="^."
P%=0
T$,".")
T$,P%+1)
=P$+T$
add_button(wi%,S$,type$,grey%,x%,y%,W%)
Do not remove or alter this procedure!
ic%,L%
(S$)+1
W%=0
. W%=
string_width(S$)+8:
W%<144
W%=144
type$
"menu":
wi%=keypadW%
1
(name$+"window%")=-1
toolheight%+=52
! x%=xm%:y%=ym%:W%=44:S$=""
_ ic%=
create_icon(0,wi%,x%,y%,W%,44,&17003133,"",buff%,valid%(33),1):$buff%=S$:buff%+=L%+1
"window":
wi%=keypadW%
/
(name$+"menu%")=-1
toolheight%+=52
! x%=xw%:y%=yw%:W%=44:S$=""
[ ic%=
create_icon(0,wi%,x%,y%,W%,44,&17003133,"",buff%,winsp%,1):$buff%=S$:buff%+=L%+1
Tools%
#
No keypad or toolpane
wi%=keypadW%
&
button%=0
padheight%+=52
+ x%=8+button%*166:y%=-padheight%+6
! button%=(button%+1)
?
wi%=keypadW%
toolheight%+=52:x%=4:y%=-toolheight%+2
type$
"option":
e ic%=
create_icon(0,wi%,x%,y%,144,48,&1700B133,"",buff%,valid%(82),L%+1):$buff%=S$:buff%+=L%+1
"radio":
" $buff%="Sradiooff,radioon"
i ic%=
create_icon(0,wi%,x%,y%,144,48,&1701B133,"",buff%+18,buff%,L%+1):$(buff%+18)=S$:buff%+=L%+19
d ic%=
create_icon(0,wi%,x%,y%,W%,48,&1700353D,"",buff%,valid%(32),L%+1):$buff%=S$:buff%+=L%+1
shade(wi%,ic%,
grey%)
find_libraries(dir$,
NX%,N%)
L%,d%,R4%,name$,f$,flag%
"OS_GBPB",9,dir$,block%,1,R4%,255
,,name$,,R4%
R4%<>-1
/ f$=dir$+"."+name$+".Customise."+
name$,2)
"OS_File",5,f$
d%,,,,L%
d%=0
f$=dir$+"."+name$+".Customise.Demo":
"OS_File",5,f$
d%,,,,L%
d%=1
NX%<N%
unique(f$,NX%+1)
8
Don't store a given library more than once
lib$(NX%)=f$:NX%+=1
L%>M%
M%=L%
2
flag%
softerror("",236):flag%=
"OS_GBPB",9,dir$,block%,1,R4%,255
,,name$,,R4%
M%>0
lib$()
unique(f$,N%)
lib$,flib$,ok%,l$
flib$=
leaf(f$)
N%-=1:lib$=
leaf(lib$(N%))
N%=0
lib$=flib$
lib$=flib$
ok%=
ok%=
ok%
lit(utilityM%,10,
lit(iconbarM%,2,